ReadLockMode(value)ReadLockMode is used to set the read lock mode for read-write
transactions.
- If isolation level is
`SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE]`,
locking semantics default to `PESSIMISTIC`.
- If isolation level is
`REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ]`,
locking semantics default to `OPTIMISTIC`.
- See `Concurrency
control <https://cloud.google.com/spanner/docs/concurrency-control>`__
for more details.
PESSIMISTIC (1):
Pessimistic lock mode.
Lock acquisition behavior depends on the isolation level in
use. In
`SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE]`
isolation, reads and writes acquire necessary locks during
transaction statement execution. In
`REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ]`
isolation, reads that explicitly request to be locked and
writes acquire locks. See `Concurrency
control <https://cloud.google.com/spanner/docs/concurrency-control>`__
for details on the types of locks acquired at each
transaction step.
OPTIMISTIC (2):
Optimistic lock mode.
Lock acquisition behavior depends on the isolation level in
use. In both
`SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE]`
and
`REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ]`
isolation, reads and writes do not acquire locks during
transaction statement execution. See `Concurrency
control <https://cloud.google.com/spanner/docs/concurrency-control>`__
for details on how the guarantees of each isolation level
are provided at commit time.
Enum |
|
|---|---|
| Name | Description |
READ_LOCK_MODE_UNSPECIFIED |
Default value. |