diff --git a/src/Spanner/CommitResponse.php b/src/Spanner/CommitResponse.php index 62b51919356..26ebc81e79a 100644 --- a/src/Spanner/CommitResponse.php +++ b/src/Spanner/CommitResponse.php @@ -19,6 +19,60 @@ class CommitResponse extends \Google\Model { + /** + * Default value. If the value is not specified, the `SERIALIZABLE` isolation + * level is used. + */ + public const ISOLATION_LEVEL_ISOLATION_LEVEL_UNSPECIFIED = 'ISOLATION_LEVEL_UNSPECIFIED'; + /** + * All transactions appear as if they executed in a serial order, even if some + * of the reads, writes, and other operations of distinct transactions + * actually occurred in parallel. Spanner assigns commit timestamps that + * reflect the order of committed transactions to implement this property. + * Spanner offers a stronger guarantee than serializability called external + * consistency. For more information, see [TrueTime and external + * consistency](https://cloud.google.com/spanner/docs/true-time-external- + * consistency#serializability). + */ + public const ISOLATION_LEVEL_SERIALIZABLE = 'SERIALIZABLE'; + /** + * All reads performed during the transaction observe a consistent snapshot of + * the database, and the transaction is only successfully committed in the + * absence of conflicts between its updates and any concurrent updates that + * have occurred since that snapshot. Consequently, in contrast to + * `SERIALIZABLE` transactions, only write-write conflicts are detected in + * snapshot transactions. This isolation level does not support read-only and + * partitioned DML transactions. When `REPEATABLE_READ` is specified on a + * read-write transaction, the locking semantics default to `OPTIMISTIC`. + */ + public const ISOLATION_LEVEL_REPEATABLE_READ = 'REPEATABLE_READ'; + /** + * Default value. * If isolation level is SERIALIZABLE, locking semantics + * default to `PESSIMISTIC`. * If isolation level is REPEATABLE_READ, locking + * semantics default to `OPTIMISTIC`. * See [Concurrency + * control](https://cloud.google.com/spanner/docs/concurrency-control) for + * more details. + */ + public const READ_LOCK_MODE_READ_LOCK_MODE_UNSPECIFIED = 'READ_LOCK_MODE_UNSPECIFIED'; + /** + * Pessimistic lock mode. Lock acquisition behavior depends on the isolation + * level in use. In SERIALIZABLE isolation, reads and writes acquire necessary + * locks during transaction statement execution. In 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. + */ + public const READ_LOCK_MODE_PESSIMISTIC = 'PESSIMISTIC'; + /** + * Optimistic lock mode. Lock acquisition behavior depends on the isolation + * level in use. In both SERIALIZABLE and 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. + */ + public const READ_LOCK_MODE_OPTIMISTIC = 'OPTIMISTIC'; protected $commitStatsType = CommitStats::class; protected $commitStatsDataType = ''; /** @@ -27,8 +81,20 @@ class CommitResponse extends \Google\Model * @var string */ public $commitTimestamp; + /** + * The isolation level used for the read-write transaction. + * + * @var string + */ + public $isolationLevel; protected $precommitTokenType = MultiplexedSessionPrecommitToken::class; protected $precommitTokenDataType = ''; + /** + * The read lock mode used for the read-write transaction. + * + * @var string + */ + public $readLockMode; /** * If `TransactionOptions.isolation_level` is set to * `IsolationLevel.REPEATABLE_READ`, then the snapshot timestamp is the @@ -72,6 +138,24 @@ public function getCommitTimestamp() { return $this->commitTimestamp; } + /** + * The isolation level used for the read-write transaction. + * + * Accepted values: ISOLATION_LEVEL_UNSPECIFIED, SERIALIZABLE, REPEATABLE_READ + * + * @param self::ISOLATION_LEVEL_* $isolationLevel + */ + public function setIsolationLevel($isolationLevel) + { + $this->isolationLevel = $isolationLevel; + } + /** + * @return self::ISOLATION_LEVEL_* + */ + public function getIsolationLevel() + { + return $this->isolationLevel; + } /** * If specified, transaction has not committed yet. You must retry the commit * with the new precommit token. @@ -89,6 +173,24 @@ public function getPrecommitToken() { return $this->precommitToken; } + /** + * The read lock mode used for the read-write transaction. + * + * Accepted values: READ_LOCK_MODE_UNSPECIFIED, PESSIMISTIC, OPTIMISTIC + * + * @param self::READ_LOCK_MODE_* $readLockMode + */ + public function setReadLockMode($readLockMode) + { + $this->readLockMode = $readLockMode; + } + /** + * @return self::READ_LOCK_MODE_* + */ + public function getReadLockMode() + { + return $this->readLockMode; + } /** * If `TransactionOptions.isolation_level` is set to * `IsolationLevel.REPEATABLE_READ`, then the snapshot timestamp is the diff --git a/src/Spanner/InstancePartition.php b/src/Spanner/InstancePartition.php index be5c947a66e..c6e2829fd1f 100644 --- a/src/Spanner/InstancePartition.php +++ b/src/Spanner/InstancePartition.php @@ -86,6 +86,8 @@ class InstancePartition extends \Google\Collection /** * The number of nodes allocated to this instance partition. Users can set the * `node_count` field to specify the target number of nodes allocated to the + * instance partition. If autoscaling is enabled, node_count is treated as an + * OUTPUT_ONLY field and reflects the current number of nodes allocated to the * instance partition. This may be zero in API responses for instance * partitions that are not yet in state `READY`. * @@ -95,9 +97,11 @@ class InstancePartition extends \Google\Collection /** * The number of processing units allocated to this instance partition. Users * can set the `processing_units` field to specify the target number of - * processing units allocated to the instance partition. This might be zero in - * API responses for instance partitions that are not yet in the `READY` - * state. + * processing units allocated to the instance partition. If autoscaling is + * enabled, processing_units is treated as an OUTPUT_ONLY field and reflects + * the current number of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. * * @var int */ @@ -253,6 +257,8 @@ public function getName() /** * The number of nodes allocated to this instance partition. Users can set the * `node_count` field to specify the target number of nodes allocated to the + * instance partition. If autoscaling is enabled, node_count is treated as an + * OUTPUT_ONLY field and reflects the current number of nodes allocated to the * instance partition. This may be zero in API responses for instance * partitions that are not yet in state `READY`. * @@ -272,9 +278,11 @@ public function getNodeCount() /** * The number of processing units allocated to this instance partition. Users * can set the `processing_units` field to specify the target number of - * processing units allocated to the instance partition. This might be zero in - * API responses for instance partitions that are not yet in the `READY` - * state. + * processing units allocated to the instance partition. If autoscaling is + * enabled, processing_units is treated as an OUTPUT_ONLY field and reflects + * the current number of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. * * @param int $processingUnits */