@google-cloud/spanner 5.18.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +3 -0
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +22 -10
- package/build/protos/google/spanner/v1/commit_response.proto +1 -1
- package/build/protos/google/spanner/v1/keys.proto +1 -1
- package/build/protos/google/spanner/v1/mutation.proto +1 -1
- package/build/protos/google/spanner/v1/query_plan.proto +1 -1
- package/build/protos/google/spanner/v1/result_set.proto +1 -2
- package/build/protos/google/spanner/v1/spanner.proto +4 -1
- package/build/protos/google/spanner/v1/transaction.proto +73 -21
- package/build/protos/google/spanner/v1/type.proto +1 -1
- package/build/protos/protos.d.ts +239 -0
- package/build/protos/protos.js +668 -1
- package/build/protos/protos.json +70 -0
- package/build/src/backup.d.ts +5 -1
- package/build/src/backup.js +2 -2
- package/build/src/batch-transaction.js +1 -1
- package/build/src/codec.d.ts +1 -1
- package/build/src/codec.js +5 -11
- package/build/src/common-grpc/service-object.js +1 -1
- package/build/src/common-grpc/service.js +2 -2
- package/build/src/database.d.ts +26 -6
- package/build/src/database.js +8 -8
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +7 -7
- package/build/src/instance.d.ts +2 -1
- package/build/src/instance.js +2 -2
- package/build/src/session-pool.d.ts +1 -0
- package/build/src/session-pool.js +51 -47
- package/build/src/session.js +1 -1
- package/build/src/table.d.ts +5 -1
- package/build/src/table.js +1 -1
- package/build/src/transaction-runner.js +3 -3
- package/build/src/transaction.d.ts +10 -2
- package/build/src/transaction.js +12 -12
- package/build/src/v1/database_admin_client.d.ts +102 -25
- package/build/src/v1/database_admin_client.js +42 -9
- package/build/src/v1/index.js +1 -0
- package/build/src/v1/instance_admin_client.d.ts +63 -18
- package/build/src/v1/instance_admin_client.js +42 -9
- package/build/src/v1/spanner_client.d.ts +70 -19
- package/build/src/v1/spanner_client.js +7 -8
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,52 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/nodejs-spanner?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [6.1.1](https://github.com/googleapis/nodejs-spanner/compare/v6.1.0...v6.1.1) (2022-07-06)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* call Promise.race without a long pending promise to prevent memory leak ([#1657](https://github.com/googleapis/nodejs-spanner/issues/1657)) ([768acb6](https://github.com/googleapis/nodejs-spanner/commit/768acb6279914dfe84e372afc1d83dd76ca3dd4d))
|
|
13
|
+
* **deps:** update dependency yargs to v17 ([#1537](https://github.com/googleapis/nodejs-spanner/issues/1537)) ([1039f68](https://github.com/googleapis/nodejs-spanner/commit/1039f68c7b459c2abeef4388fd8541576d374b66))
|
|
14
|
+
|
|
15
|
+
## [6.1.0](https://github.com/googleapis/nodejs-spanner/compare/v6.0.0...v6.1.0) (2022-07-04)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add Session creator role ([91ef6d3](https://github.com/googleapis/nodejs-spanner/commit/91ef6d373a1ed2c7e191de4003571270bfc4e895))
|
|
21
|
+
* Adding two new fields for Instance create_time and update_time ([#1641](https://github.com/googleapis/nodejs-spanner/issues/1641)) ([91ef6d3](https://github.com/googleapis/nodejs-spanner/commit/91ef6d373a1ed2c7e191de4003571270bfc4e895))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **deps:** update dependency @google-cloud/promisify to v3 ([#1629](https://github.com/googleapis/nodejs-spanner/issues/1629)) ([1467956](https://github.com/googleapis/nodejs-spanner/commit/1467956314c77f66034fa3db166ba68d7c2aba2d))
|
|
27
|
+
* Improve spanner.date handling of years before 1000AD ([#1654](https://github.com/googleapis/nodejs-spanner/issues/1654)) ([fd89a29](https://github.com/googleapis/nodejs-spanner/commit/fd89a294dcab017dbbe7000bce613b0d4ed60f96))
|
|
28
|
+
|
|
29
|
+
## [6.0.0](https://github.com/googleapis/nodejs-spanner/compare/v5.18.0...v6.0.0) (2022-06-07)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### ⚠ BREAKING CHANGES
|
|
33
|
+
|
|
34
|
+
* update library to use Node 12 (#1637)
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* Adding IT for date and commit timestamp ([#1621](https://github.com/googleapis/nodejs-spanner/issues/1621)) ([1367aa7](https://github.com/googleapis/nodejs-spanner/commit/1367aa7dc9818be5610dfc5ae67d09652e7009e5))
|
|
39
|
+
* AuditConfig for IAM v1 ([#1599](https://github.com/googleapis/nodejs-spanner/issues/1599)) ([c358d66](https://github.com/googleapis/nodejs-spanner/commit/c358d668ca2a25f99ab73a4b6c1ebbe09c34d4de))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* **deps:** update dependency grpc-gcp to ^0.4.0 ([#1603](https://github.com/googleapis/nodejs-spanner/issues/1603)) ([f00b3c6](https://github.com/googleapis/nodejs-spanner/commit/f00b3c65e58c2f36e69a05fef0b3c9bc68a4ee55))
|
|
45
|
+
* fixes for dynamic routing and streaming descriptors ([#1639](https://github.com/googleapis/nodejs-spanner/issues/1639)) ([977a543](https://github.com/googleapis/nodejs-spanner/commit/977a543d693ca2f2e8bb303be6df592aa4def1dd))
|
|
46
|
+
* pin version for nodejs gax-node ([#1617](https://github.com/googleapis/nodejs-spanner/issues/1617)) ([fb0017f](https://github.com/googleapis/nodejs-spanner/commit/fb0017ffab3cfa41cd132df4511a47fb68439bf5))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Build System
|
|
50
|
+
|
|
51
|
+
* update library to use Node 12 ([#1637](https://github.com/googleapis/nodejs-spanner/issues/1637)) ([994acf3](https://github.com/googleapis/nodejs-spanner/commit/994acf3edd7c261085f58722fa2f86f95b3a56f3))
|
|
52
|
+
|
|
7
53
|
## [5.18.0](https://github.com/googleapis/nodejs-spanner/compare/v5.17.0...v5.18.0) (2022-04-03)
|
|
8
54
|
|
|
9
55
|
|
package/README.md
CHANGED
|
@@ -129,13 +129,16 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-spanner/tre
|
|
|
129
129
|
| Numeric-add-column | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/numeric-add-column.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/numeric-add-column.js,samples/README.md) |
|
|
130
130
|
| Numeric-query-parameter | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/numeric-query-parameter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/numeric-query-parameter.js,samples/README.md) |
|
|
131
131
|
| Numeric-update-data | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/numeric-update-data.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/numeric-update-data.js,samples/README.md) |
|
|
132
|
+
| Adds a column to an existing table in a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-add-column.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-add-column.js,samples/README.md) |
|
|
132
133
|
| Showcase the rules for case-sensitivity and case folding for a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-case-sensitivity.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-case-sensitivity.js,samples/README.md) |
|
|
133
134
|
| Creates a PostgreSQL Database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-database-create.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-database-create.js,samples/README.md) |
|
|
134
135
|
| Use cast operator to cast from one data type to another in a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-datatypes-casting.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-datatypes-casting.js,samples/README.md) |
|
|
135
136
|
| Execute a batch of DML statements on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-dml-batch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-dml-batch.js,samples/README.md) |
|
|
137
|
+
| Updates data in a table in a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-dml-getting-started-update.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-dml-getting-started-update.js,samples/README.md) |
|
|
136
138
|
| Execute a Partitioned DML on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-dml-partitioned.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-dml-partitioned.js,samples/README.md) |
|
|
137
139
|
| Execute a DML statement with parameters on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-dml-with-parameter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-dml-with-parameter.js,samples/README.md) |
|
|
138
140
|
| Calls a server side function on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-functions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-functions.js,samples/README.md) |
|
|
141
|
+
| Creates a new storing index in a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-index-create-storing.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-index-create-storing.js,samples/README.md) |
|
|
139
142
|
| Created interleaved table hierarchy using PostgreSQL dialect. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-interleaving.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-interleaving.js,samples/README.md) |
|
|
140
143
|
| Showcase how to work with the PostgreSQL NUMERIC/DECIMAL data type on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-numeric-data-type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-numeric-data-type.js,samples/README.md) |
|
|
141
144
|
| Showcases how a Spanner PostgreSQL database orders null values in a query. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-ordering-nulls.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-ordering-nulls.js,samples/README.md) |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2022 Google LLC
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -179,7 +179,7 @@ service InstanceAdmin {
|
|
|
179
179
|
// [Instance][google.spanner.admin.instance.v1.Instance], if successful.
|
|
180
180
|
//
|
|
181
181
|
// Authorization requires `spanner.instances.update` permission on
|
|
182
|
-
// resource [name][google.spanner.admin.instance.v1.Instance.name].
|
|
182
|
+
// the resource [name][google.spanner.admin.instance.v1.Instance.name].
|
|
183
183
|
rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) {
|
|
184
184
|
option (google.api.http) = {
|
|
185
185
|
patch: "/v1/{instance.name=projects/*/instances/*}"
|
|
@@ -309,7 +309,7 @@ message InstanceConfig {
|
|
|
309
309
|
|
|
310
310
|
// A unique identifier for the instance configuration. Values
|
|
311
311
|
// are of the form
|
|
312
|
-
// `projects/<project>/instanceConfigs/[a-z][-a-z0-9]
|
|
312
|
+
// `projects/<project>/instanceConfigs/[a-z][-a-z0-9]*`.
|
|
313
313
|
string name = 1;
|
|
314
314
|
|
|
315
315
|
// The name of this instance configuration as it appears in UIs.
|
|
@@ -319,7 +319,7 @@ message InstanceConfig {
|
|
|
319
319
|
// replication properties.
|
|
320
320
|
repeated ReplicaInfo replicas = 3;
|
|
321
321
|
|
|
322
|
-
// Allowed values of the
|
|
322
|
+
// Allowed values of the "default_leader" schema option for databases in
|
|
323
323
|
// instances that use this instance configuration.
|
|
324
324
|
repeated string leader_options = 4;
|
|
325
325
|
}
|
|
@@ -367,17 +367,23 @@ message Instance {
|
|
|
367
367
|
// Must be unique per project and between 4 and 30 characters in length.
|
|
368
368
|
string display_name = 3 [(google.api.field_behavior) = REQUIRED];
|
|
369
369
|
|
|
370
|
-
//
|
|
371
|
-
//
|
|
370
|
+
// The number of nodes allocated to this instance. At most one of either
|
|
371
|
+
// node_count or processing_units should be present in the message. This
|
|
372
|
+
// may be zero in API responses for instances that are not yet in state
|
|
373
|
+
// `READY`.
|
|
372
374
|
//
|
|
373
375
|
// See [the
|
|
374
|
-
// documentation](https://cloud.google.com/spanner/docs/
|
|
375
|
-
// for more information about nodes.
|
|
376
|
+
// documentation](https://cloud.google.com/spanner/docs/compute-capacity)
|
|
377
|
+
// for more information about nodes and processing units.
|
|
376
378
|
int32 node_count = 5;
|
|
377
379
|
|
|
378
380
|
// The number of processing units allocated to this instance. At most one of
|
|
379
381
|
// processing_units or node_count should be present in the message. This may
|
|
380
382
|
// be zero in API responses for instances that are not yet in state `READY`.
|
|
383
|
+
//
|
|
384
|
+
// See [the
|
|
385
|
+
// documentation](https://cloud.google.com/spanner/docs/compute-capacity)
|
|
386
|
+
// for more information about nodes and processing units.
|
|
381
387
|
int32 processing_units = 9;
|
|
382
388
|
|
|
383
389
|
// Output only. The current instance state. For
|
|
@@ -395,9 +401,9 @@ message Instance {
|
|
|
395
401
|
// firewall, load balancing, etc.).
|
|
396
402
|
//
|
|
397
403
|
// * Label keys must be between 1 and 63 characters long and must conform to
|
|
398
|
-
// the following regular expression: `[a-z]
|
|
404
|
+
// the following regular expression: `[a-z][a-z0-9_-]{0,62}`.
|
|
399
405
|
// * Label values must be between 0 and 63 characters long and must conform
|
|
400
|
-
// to the regular expression `
|
|
406
|
+
// to the regular expression `[a-z0-9_-]{0,63}`.
|
|
401
407
|
// * No more than 64 labels can be associated with a given resource.
|
|
402
408
|
//
|
|
403
409
|
// See https://goo.gl/xmQnxf for more information on and examples of labels.
|
|
@@ -412,6 +418,12 @@ message Instance {
|
|
|
412
418
|
|
|
413
419
|
// Deprecated. This field is not populated.
|
|
414
420
|
repeated string endpoint_uris = 8;
|
|
421
|
+
|
|
422
|
+
// Output only. The time at which the instance was created.
|
|
423
|
+
google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
424
|
+
|
|
425
|
+
// Output only. The time at which the instance was most recently updated.
|
|
426
|
+
google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
415
427
|
}
|
|
416
428
|
|
|
417
429
|
// The request for [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2022 Google LLC
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -17,7 +17,6 @@ syntax = "proto3";
|
|
|
17
17
|
package google.spanner.v1;
|
|
18
18
|
|
|
19
19
|
import "google/protobuf/struct.proto";
|
|
20
|
-
import "google/spanner/v1/commit_response.proto";
|
|
21
20
|
import "google/spanner/v1/query_plan.proto";
|
|
22
21
|
import "google/spanner/v1/transaction.proto";
|
|
23
22
|
import "google/spanner/v1/type.proto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2022 Google LLC
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -358,6 +358,9 @@ message Session {
|
|
|
358
358
|
// Output only. The approximate timestamp when the session is last used. It is
|
|
359
359
|
// typically earlier than the actual last use time.
|
|
360
360
|
google.protobuf.Timestamp approximate_last_use_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
361
|
+
|
|
362
|
+
// The database role which created this session.
|
|
363
|
+
string creator_role = 5;
|
|
361
364
|
}
|
|
362
365
|
|
|
363
366
|
// The request for [GetSession][google.spanner.v1.Spanner.GetSession].
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2022 Google LLC
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -35,7 +35,8 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
35
35
|
// completed, the session can immediately be re-used for the next transaction.
|
|
36
36
|
// It is not necessary to create a new session for each transaction.
|
|
37
37
|
//
|
|
38
|
-
// Transaction
|
|
38
|
+
// Transaction modes:
|
|
39
|
+
//
|
|
39
40
|
// Cloud Spanner supports three transaction modes:
|
|
40
41
|
//
|
|
41
42
|
// 1. Locking read-write. This type of transaction is the only way
|
|
@@ -44,11 +45,18 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
44
45
|
// Locking read-write transactions may abort, requiring the
|
|
45
46
|
// application to retry.
|
|
46
47
|
//
|
|
47
|
-
// 2. Snapshot read-only.
|
|
48
|
-
// consistency across several reads, but
|
|
49
|
-
// writes. Snapshot read-only transactions can be configured to
|
|
50
|
-
//
|
|
51
|
-
//
|
|
48
|
+
// 2. Snapshot read-only. Snapshot read-only transactions provide guaranteed
|
|
49
|
+
// consistency across several reads, but do not allow
|
|
50
|
+
// writes. Snapshot read-only transactions can be configured to read at
|
|
51
|
+
// timestamps in the past, or configured to perform a strong read
|
|
52
|
+
// (where Spanner will select a timestamp such that the read is
|
|
53
|
+
// guaranteed to see the effects of all transactions that have committed
|
|
54
|
+
// before the start of the read). Snapshot read-only transactions do not
|
|
55
|
+
// need to be committed.
|
|
56
|
+
//
|
|
57
|
+
// Queries on change streams must be performed with the snapshot read-only
|
|
58
|
+
// transaction mode, specifying a strong read. Please see
|
|
59
|
+
// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong] for more details.
|
|
52
60
|
//
|
|
53
61
|
// 3. Partitioned DML. This type of transaction is used to execute
|
|
54
62
|
// a single Partitioned DML statement. Partitioned DML partitions
|
|
@@ -63,11 +71,12 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
63
71
|
// not conflict with read-write transactions. As a consequence of not
|
|
64
72
|
// taking locks, they also do not abort, so retry loops are not needed.
|
|
65
73
|
//
|
|
66
|
-
// Transactions may only read
|
|
67
|
-
// may, however, read
|
|
74
|
+
// Transactions may only read-write data in a single database. They
|
|
75
|
+
// may, however, read-write data in different tables within that
|
|
68
76
|
// database.
|
|
69
77
|
//
|
|
70
|
-
// Locking
|
|
78
|
+
// Locking read-write transactions:
|
|
79
|
+
//
|
|
71
80
|
// Locking transactions may be used to atomically read-modify-write
|
|
72
81
|
// data anywhere in a database. This type of transaction is externally
|
|
73
82
|
// consistent.
|
|
@@ -78,7 +87,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
78
87
|
// active as long as the transaction continues to do reads, and the
|
|
79
88
|
// transaction has not been terminated by
|
|
80
89
|
// [Commit][google.spanner.v1.Spanner.Commit] or
|
|
81
|
-
// [Rollback][google.spanner.v1.Spanner.Rollback].
|
|
90
|
+
// [Rollback][google.spanner.v1.Spanner.Rollback]. Long periods of
|
|
82
91
|
// inactivity at the client may cause Cloud Spanner to release a
|
|
83
92
|
// transaction's locks and abort it.
|
|
84
93
|
//
|
|
@@ -90,6 +99,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
90
99
|
// transaction.
|
|
91
100
|
//
|
|
92
101
|
// Semantics:
|
|
102
|
+
//
|
|
93
103
|
// Cloud Spanner can commit the transaction if all read locks it acquired
|
|
94
104
|
// are still valid at commit time, and it is able to acquire write
|
|
95
105
|
// locks for all writes. Cloud Spanner can abort the transaction for any
|
|
@@ -101,7 +111,8 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
101
111
|
// use Cloud Spanner locks for any sort of mutual exclusion other than
|
|
102
112
|
// between Cloud Spanner transactions themselves.
|
|
103
113
|
//
|
|
104
|
-
// Retrying
|
|
114
|
+
// Retrying aborted transactions:
|
|
115
|
+
//
|
|
105
116
|
// When a transaction aborts, the application can choose to retry the
|
|
106
117
|
// whole transaction again. To maximize the chances of successfully
|
|
107
118
|
// committing the retry, the client should execute the retry in the
|
|
@@ -116,7 +127,8 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
116
127
|
// instead, it is better to limit the total amount of time spent
|
|
117
128
|
// retrying.
|
|
118
129
|
//
|
|
119
|
-
// Idle
|
|
130
|
+
// Idle transactions:
|
|
131
|
+
//
|
|
120
132
|
// A transaction is considered idle if it has no outstanding reads or
|
|
121
133
|
// SQL queries and has not started a read or SQL query within the last 10
|
|
122
134
|
// seconds. Idle transactions can be aborted by Cloud Spanner so that they
|
|
@@ -127,7 +139,8 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
127
139
|
// SQL query in the transaction (for example, `SELECT 1`) prevents the
|
|
128
140
|
// transaction from becoming idle.
|
|
129
141
|
//
|
|
130
|
-
// Snapshot
|
|
142
|
+
// Snapshot read-only transactions:
|
|
143
|
+
//
|
|
131
144
|
// Snapshot read-only transactions provides a simpler method than
|
|
132
145
|
// locking read-write transactions for doing several consistent
|
|
133
146
|
// reads. However, this type of transaction does not support writes.
|
|
@@ -159,13 +172,12 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
159
172
|
//
|
|
160
173
|
// If the Cloud Spanner database to be read is geographically distributed,
|
|
161
174
|
// stale read-only transactions can execute more quickly than strong
|
|
162
|
-
// or read-write
|
|
175
|
+
// or read-write transactions, because they are able to execute far
|
|
163
176
|
// from the leader replica.
|
|
164
177
|
//
|
|
165
178
|
// Each type of timestamp bound is discussed in detail below.
|
|
166
179
|
//
|
|
167
|
-
// Strong:
|
|
168
|
-
// Strong reads are guaranteed to see the effects of all transactions
|
|
180
|
+
// Strong: Strong reads are guaranteed to see the effects of all transactions
|
|
169
181
|
// that have committed before the start of the read. Furthermore, all
|
|
170
182
|
// rows yielded by a single read are consistent with each other -- if
|
|
171
183
|
// any part of the read observes a transaction, all parts of the read
|
|
@@ -177,9 +189,13 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
177
189
|
// reads should be executed within a transaction or at an exact read
|
|
178
190
|
// timestamp.
|
|
179
191
|
//
|
|
192
|
+
// Queries on change streams (see below for more details) must also specify
|
|
193
|
+
// the strong read timestamp bound.
|
|
194
|
+
//
|
|
180
195
|
// See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong].
|
|
181
196
|
//
|
|
182
|
-
// Exact
|
|
197
|
+
// Exact staleness:
|
|
198
|
+
//
|
|
183
199
|
// These timestamp bounds execute reads at a user-specified
|
|
184
200
|
// timestamp. Reads at a timestamp are guaranteed to see a consistent
|
|
185
201
|
// prefix of the global transaction history: they observe
|
|
@@ -200,7 +216,8 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
200
216
|
// See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and
|
|
201
217
|
// [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness].
|
|
202
218
|
//
|
|
203
|
-
// Bounded
|
|
219
|
+
// Bounded staleness:
|
|
220
|
+
//
|
|
204
221
|
// Bounded staleness modes allow Cloud Spanner to pick the read timestamp,
|
|
205
222
|
// subject to a user-provided staleness bound. Cloud Spanner chooses the
|
|
206
223
|
// newest timestamp within the staleness bound that allows execution
|
|
@@ -229,7 +246,8 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
229
246
|
// See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and
|
|
230
247
|
// [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp].
|
|
231
248
|
//
|
|
232
|
-
// Old
|
|
249
|
+
// Old read timestamps and garbage collection:
|
|
250
|
+
//
|
|
233
251
|
// Cloud Spanner continuously garbage collects deleted and overwritten data
|
|
234
252
|
// in the background to reclaim storage space. This process is known
|
|
235
253
|
// as "version GC". By default, version GC reclaims versions after they
|
|
@@ -239,7 +257,41 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
239
257
|
// timestamp become too old while executing. Reads and SQL queries with
|
|
240
258
|
// too-old read timestamps fail with the error `FAILED_PRECONDITION`.
|
|
241
259
|
//
|
|
242
|
-
//
|
|
260
|
+
// You can configure and extend the `VERSION_RETENTION_PERIOD` of a
|
|
261
|
+
// database up to a period as long as one week, which allows Cloud Spanner
|
|
262
|
+
// to perform reads up to one week in the past.
|
|
263
|
+
//
|
|
264
|
+
// Querying change Streams:
|
|
265
|
+
//
|
|
266
|
+
// A Change Stream is a schema object that can be configured to watch data
|
|
267
|
+
// changes on the entire database, a set of tables, or a set of columns
|
|
268
|
+
// in a database.
|
|
269
|
+
//
|
|
270
|
+
// When a change stream is created, Spanner automatically defines a
|
|
271
|
+
// corresponding SQL Table-Valued Function (TVF) that can be used to query
|
|
272
|
+
// the change records in the associated change stream using the
|
|
273
|
+
// ExecuteStreamingSql API. The name of the TVF for a change stream is
|
|
274
|
+
// generated from the name of the change stream: READ_<change_stream_name>.
|
|
275
|
+
//
|
|
276
|
+
// All queries on change stream TVFs must be executed using the
|
|
277
|
+
// ExecuteStreamingSql API with a single-use read-only transaction with a
|
|
278
|
+
// strong read-only timestamp_bound. The change stream TVF allows users to
|
|
279
|
+
// specify the start_timestamp and end_timestamp for the time range of
|
|
280
|
+
// interest. All change records within the retention period is accessible
|
|
281
|
+
// using the strong read-only timestamp_bound. All other TransactionOptions
|
|
282
|
+
// are invalid for change stream queries.
|
|
283
|
+
//
|
|
284
|
+
// In addition, if TransactionOptions.read_only.return_read_timestamp is set
|
|
285
|
+
// to true, a special value of 2^63 - 2 will be returned in the
|
|
286
|
+
// [Transaction][google.spanner.v1.Transaction] message that describes the
|
|
287
|
+
// transaction, instead of a valid read timestamp. This special value should be
|
|
288
|
+
// discarded and not used for any subsequent queries.
|
|
289
|
+
//
|
|
290
|
+
// Please see https://cloud.google.com/spanner/docs/change-streams
|
|
291
|
+
// for more details on how to query the change stream TVFs.
|
|
292
|
+
//
|
|
293
|
+
// Partitioned DML transactions:
|
|
294
|
+
//
|
|
243
295
|
// Partitioned DML transactions are used to execute DML statements with a
|
|
244
296
|
// different execution strategy that provides different, and often better,
|
|
245
297
|
// scalability properties for large, table-wide operations than DML in a
|