Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spanner): [Spanner] add directed_read_option in spanner.proto #6759

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Spanner/metadata/V1/Spanner.php
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
* The API may return fewer than the requested number of sessions. If a
* specific number of sessions are desired, the client can make additional
* calls to BatchCreateSessions (adjusting
* [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] as necessary).
* [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count]
* as necessary).
*/
function batch_create_sessions_sample(string $formattedDatabase, int $sessionCount): void
{
Expand Down
3 changes: 2 additions & 1 deletion Spanner/samples/V1/SpannerClient/begin_transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

/**
* Begins a new transaction. This step can often be skipped:
* [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
* [Read][google.spanner.v1.Spanner.Read],
* [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
* [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
* side-effect.
*
Expand Down
13 changes: 7 additions & 6 deletions Spanner/samples/V1/SpannerClient/execute_batch_dml.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@
* [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
*
* Statements are executed in sequential order. A request can succeed even if
* a statement fails. The [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] field in the
* response provides information about the statement that failed. Clients must
* inspect this field to determine whether an error occurred.
* a statement fails. The
* [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status]
* field in the response provides information about the statement that failed.
* Clients must inspect this field to determine whether an error occurred.
*
* Execution stops after the first failed statement; the remaining statements
* are not executed.
*
* @param string $formattedSession The session in which the DML statements should be performed. Please see
* {@see SpannerClient::sessionName()} for help formatting this field.
* @param string $statementsSql The DML string.
* @param int $seqno A per-transaction sequence number used to identify this request. This field
* makes each request idempotent such that if the request is received multiple
* times, at most one will succeed.
* @param int $seqno A per-transaction sequence number used to identify this request.
* This field makes each request idempotent such that if the request is
* received multiple times, at most one will succeed.
*
* The sequence number must be monotonically increasing within the
* transaction. If a request arrives for the first time with an out-of-order
Expand Down
6 changes: 4 additions & 2 deletions Spanner/samples/V1/SpannerClient/execute_sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
*
* Operations inside read-write transactions might return `ABORTED`. If
* this occurs, the application should restart the transaction from
* the beginning. See [Transaction][google.spanner.v1.Transaction] for more details.
* the beginning. See [Transaction][google.spanner.v1.Transaction] for more
* details.
*
* Larger result sets can be fetched in streaming fashion by calling
* [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] instead.
* [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
* instead.
*
* @param string $formattedSession The session in which the SQL query should be performed. Please see
* {@see SpannerClient::sessionName()} for help formatting this field.
Expand Down
10 changes: 5 additions & 5 deletions Spanner/samples/V1/SpannerClient/execute_streaming_sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
use Google\Cloud\Spanner\V1\SpannerClient;

/**
* Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the result
* set as a stream. Unlike [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there
* is no limit on the size of the returned result set. However, no
* individual row in the result set can exceed 100 MiB, and no
* column value can exceed 10 MiB.
* Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the
* result set as a stream. Unlike
* [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on
* the size of the returned result set. However, no individual row in the
* result set can exceed 100 MiB, and no column value can exceed 10 MiB.
*
* @param string $formattedSession The session in which the SQL query should be performed. Please see
* {@see SpannerClient::sessionName()} for help formatting this field.
Expand Down
26 changes: 14 additions & 12 deletions Spanner/samples/V1/SpannerClient/partition_query.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
/**
* Creates a set of partition tokens that can be used to execute a query
* operation in parallel. Each of the returned partition tokens can be used
* by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset
* of the query result to read. The same session and read-only transaction
* must be used by the PartitionQueryRequest used to create the
* partition tokens and the ExecuteSqlRequests that use the partition tokens.
* by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
* specify a subset of the query result to read. The same session and
* read-only transaction must be used by the PartitionQueryRequest used to
* create the partition tokens and the ExecuteSqlRequests that use the
* partition tokens.
*
* Partition tokens become invalid when the session used to create them
* is deleted, is idle for too long, begins a new transaction, or becomes too
Expand All @@ -42,15 +43,16 @@
*
* @param string $formattedSession The session used to create the partitions. Please see
* {@see SpannerClient::sessionName()} for help formatting this field.
* @param string $sql The query request to generate partitions for. The request will fail if
* the query is not root partitionable. The query plan of a root
* partitionable query has a single distributed union operator. A distributed
* union operator conceptually divides one or more tables into multiple
* splits, remotely evaluates a subquery independently on each split, and
* then unions all results.
* @param string $sql The query request to generate partitions for. The request will
* fail if the query is not root partitionable. For a query to be root
* partitionable, it needs to satisfy a few conditions. For example, the first
* operator in the query execution plan must be a distributed union operator.
* For more information about other conditions, see [Read data in
* parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel).
*
* This must not contain DML commands, such as INSERT, UPDATE, or
* DELETE. Use [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a
* The query request must not contain DML commands, such as INSERT, UPDATE, or
* DELETE. Use
* [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a
* PartitionedDml transaction for large, partition-friendly DML operations.
*/
function partition_query_sample(string $formattedSession, string $sql): void
Expand Down
13 changes: 7 additions & 6 deletions Spanner/samples/V1/SpannerClient/partition_read.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
/**
* Creates a set of partition tokens that can be used to execute a read
* operation in parallel. Each of the returned partition tokens can be used
* by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read
* result to read. The same session and read-only transaction must be used by
* the PartitionReadRequest used to create the partition tokens and the
* ReadRequests that use the partition tokens. There are no ordering
* guarantees on rows returned among the returned partition tokens, or even
* within each individual StreamingRead call issued with a partition_token.
* by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
* subset of the read result to read. The same session and read-only
* transaction must be used by the PartitionReadRequest used to create the
* partition tokens and the ReadRequests that use the partition tokens. There
* are no ordering guarantees on rows returned among the returned partition
* tokens, or even within each individual StreamingRead call issued with a
* partition_token.
*
* Partition tokens become invalid when the session used to create them
* is deleted, is idle for too long, begins a new transaction, or becomes too
Expand Down
11 changes: 6 additions & 5 deletions Spanner/samples/V1/SpannerClient/read.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,24 @@
/**
* Reads rows from the database using key lookups and scans, as a
* simple key/value style alternative to
* [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be used to
* return a result set larger than 10 MiB; if the read matches more
* [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be
* used to return a result set larger than 10 MiB; if the read matches more
* data than that, the read fails with a `FAILED_PRECONDITION`
* error.
*
* Reads inside read-write transactions might return `ABORTED`. If
* this occurs, the application should restart the transaction from
* the beginning. See [Transaction][google.spanner.v1.Transaction] for more details.
* the beginning. See [Transaction][google.spanner.v1.Transaction] for more
* details.
*
* Larger result sets can be yielded in streaming fashion by calling
* [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
*
* @param string $formattedSession The session in which the read should be performed. Please see
* {@see SpannerClient::sessionName()} for help formatting this field.
* @param string $table The name of the table in the database to be read.
* @param string $columnsElement The columns of [table][google.spanner.v1.ReadRequest.table] to be returned for each row matching
* this request.
* @param string $columnsElement The columns of [table][google.spanner.v1.ReadRequest.table] to be
* returned for each row matching this request.
*/
function read_sample(string $formattedSession, string $table, string $columnsElement): void
{
Expand Down
5 changes: 3 additions & 2 deletions Spanner/samples/V1/SpannerClient/rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
/**
* Rolls back a transaction, releasing any locks it holds. It is a good
* idea to call this for any transaction that includes one or more
* [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and
* ultimately decides not to commit.
* [Read][google.spanner.v1.Spanner.Read] or
* [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
* decides not to commit.
*
* `Rollback` returns `OK` if it successfully aborts the transaction, the
* transaction was already aborted, or the transaction is not
Expand Down
10 changes: 5 additions & 5 deletions Spanner/samples/V1/SpannerClient/streaming_read.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
use Google\Cloud\Spanner\V1\SpannerClient;

/**
* Like [Read][google.spanner.v1.Spanner.Read], except returns the result set as a
* stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no limit on the
* size of the returned result set. However, no individual row in
* Like [Read][google.spanner.v1.Spanner.Read], except returns the result set
* as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no
* limit on the size of the returned result set. However, no individual row in
* the result set can exceed 100 MiB, and no column value can exceed
* 10 MiB.
*
* @param string $formattedSession The session in which the read should be performed. Please see
* {@see SpannerClient::sessionName()} for help formatting this field.
* @param string $table The name of the table in the database to be read.
* @param string $columnsElement The columns of [table][google.spanner.v1.ReadRequest.table] to be returned for each row matching
* this request.
* @param string $columnsElement The columns of [table][google.spanner.v1.ReadRequest.table] to be
* returned for each row matching this request.
*/
function streaming_read_sample(
string $formattedSession,
Expand Down
24 changes: 12 additions & 12 deletions Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
* $operationResponse->pollUntilComplete();
* if ($operationResponse->operationSucceeded()) {
* $result = $operationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $operationResponse->getError();
* // handleError($error)
Expand All @@ -121,7 +121,7 @@
* }
* if ($newOperationResponse->operationSucceeded()) {
* $result = $newOperationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $newOperationResponse->getError();
* // handleError($error)
Expand Down Expand Up @@ -550,7 +550,7 @@ public function __construct(array $options = [])
* $operationResponse->pollUntilComplete();
* if ($operationResponse->operationSucceeded()) {
* $result = $operationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $operationResponse->getError();
* // handleError($error)
Expand All @@ -567,7 +567,7 @@ public function __construct(array $options = [])
* }
* if ($newOperationResponse->operationSucceeded()) {
* $result = $newOperationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $newOperationResponse->getError();
* // handleError($error)
Expand Down Expand Up @@ -669,7 +669,7 @@ public function copyBackup(
* $operationResponse->pollUntilComplete();
* if ($operationResponse->operationSucceeded()) {
* $result = $operationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $operationResponse->getError();
* // handleError($error)
Expand All @@ -686,7 +686,7 @@ public function copyBackup(
* }
* if ($newOperationResponse->operationSucceeded()) {
* $result = $newOperationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $newOperationResponse->getError();
* // handleError($error)
Expand Down Expand Up @@ -775,7 +775,7 @@ public function createBackup(
* $operationResponse->pollUntilComplete();
* if ($operationResponse->operationSucceeded()) {
* $result = $operationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $operationResponse->getError();
* // handleError($error)
Expand All @@ -792,7 +792,7 @@ public function createBackup(
* }
* if ($newOperationResponse->operationSucceeded()) {
* $result = $newOperationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $newOperationResponse->getError();
* // handleError($error)
Expand Down Expand Up @@ -1778,7 +1778,7 @@ public function listDatabases($parent, array $optionalArgs = [])
* $operationResponse->pollUntilComplete();
* if ($operationResponse->operationSucceeded()) {
* $result = $operationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $operationResponse->getError();
* // handleError($error)
Expand All @@ -1795,7 +1795,7 @@ public function listDatabases($parent, array $optionalArgs = [])
* }
* if ($newOperationResponse->operationSucceeded()) {
* $result = $newOperationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $newOperationResponse->getError();
* // handleError($error)
Expand Down Expand Up @@ -2113,7 +2113,7 @@ public function updateBackup($backup, $updateMask, array $optionalArgs = [])
* $operationResponse->pollUntilComplete();
* if ($operationResponse->operationSucceeded()) {
* $result = $operationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $operationResponse->getError();
* // handleError($error)
Expand All @@ -2130,7 +2130,7 @@ public function updateBackup($backup, $updateMask, array $optionalArgs = [])
* }
* if ($newOperationResponse->operationSucceeded()) {
* $result = $newOperationResponse->getResult();
* // doSomethingWith($result)
* // doSomethingWith($result)
* } else {
* $error = $newOperationResponse->getError();
* // handleError($error)
Expand Down
Loading
Loading