You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the default ``SERIALIZABLE`` mode transactions may fail with ``Aborted`` exception. This is a transient kind of errors, which mostly happen to prevent data corruption by concurrent modifications. Though the original transaction becomes non operational, a simple retry of the queries solves the issue.
292
+
In ``SERIALIZABLE`` isolation mode, transactions may fail with an ``Aborted`` exception.
293
+
This happens if there are conflicts between different transactions, for example if one
294
+
transaction tries to read data that another transaction has modified. Aborted transactions
295
+
should be retried by the client. The Spanner SQLAlchemy provider automatically retries
296
+
aborted transactions.
291
297
292
-
This, however, may require to manually repeat a long list of operations, executed in the failed transaction. To simplify it, Spanner Connection API tracks all the operations, executed inside current transaction, and their result checksums. If the transaction failed with ``Aborted`` exception, the Connection API will automatically start a new transaction and will re-run all the tracked operations, checking if their results are the same as they were in the original transaction. In case data changed, and results differ, the transaction is dropped, as there is no way to automatically retry it.
298
+
Isolation level ``SERIALIZABLE`` takes lock for both **reads and writes**.
293
299
294
-
In ``AUTOCOMMIT`` mode automatic transactions retry mechanism is disabled, as every operation is committed just in time, and there is no way an ``Aborted`` exception can happen.
300
+
Use isolation level ``REPEATABLE READ`` to reduce the amount of locks that
301
+
are taken by read/write transactions. ``REPEATABLE READ`` only takes locks
302
+
for **writes** and for queries that use a ``FOR UPDATE`` clause.
0 commit comments