Skip to content

Instantly share code, notes, and snippets.

@yfuruyama
Created December 2, 2018 08:24
Show Gist options
  • Select an option

  • Save yfuruyama/a2fef5cfabf7f94b8c4869943783242d to your computer and use it in GitHub Desktop.

Select an option

Save yfuruyama/a2fef5cfabf7f94b8c4869943783242d to your computer and use it in GitHub Desktop.
+------------------------------------------------------+------------------------------------------------------+
| tx1 | tx2 |
+------------------------------------------------------+------------------------------------------------------+
| spanner> BEGIN; | |
| Query OK, 0 rows affected (0.01 sec) | |
| | |
| | spanner> BEGIN; |
| | Query OK, 0 rows affected (0.05 sec) |
| | |
| spanner> SELECT * FROM Counters WHERE Id = 1; | |
| +----+-------+ | |
| | Id | Value | | |
| +----+-------+ | |
| | 1 | 0 | | |
| +----+-------+ | |
| 1 rows in set (20.02 msecs) | |
| | |
| | spanner> SELECT * FROM Counters WHERE Id = 1; |
| | +----+-------+ |
| | | Id | Value | |
| | +----+-------+ |
| | | 1 | 0 | |
| | +----+-------+ |
| | 1 rows in set (3.07 msecs) |
| | |
| spanner> UPDATE Counters SET Value = 1 WHERE Id = 1; | |
| Query OK, 1 rows affected (0.58 sec) | |
| | |
| | spanner> UPDATE Counters SET Value = 1 WHERE Id = 1; |
| | Query OK, 1 rows affected (0.57 sec) |
| | |
| spanner> COMMIT; | |
| Query OK, 0 rows affected (0.46 sec) | |
| | |
| | spanner> COMMIT; |
| | ERROR: transaction was aborted |
| | |
| spanner> SELECT * FROM Counters WHERE Id = 1; | |
| +----+-------+ | |
| | Id | Value | | |
| +----+-------+ | |
| | 1 | 1 | | |
| +----+-------+ | |
| 1 rows in set (19.3 msecs) | |
| | |
+------------------------------------------------------+------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment