From 2c28f646ca77b1d57550368be22aa388adde2e66 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Thu, 26 Dec 2019 19:29:17 -0800 Subject: [PATCH] firestore: retry reads that fail with contention PiperOrigin-RevId: 287250665 --- google/firestore/v1/firestore.proto | 26 +++++++------------ .../v1/firestore_grpc_service_config.json | 3 +++ google/firestore/v1/query.proto | 24 ++++++++--------- google/firestore/v1/write.proto | 7 +++++ 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/google/firestore/v1/firestore.proto b/google/firestore/v1/firestore.proto index a07b267d..9af30b7a 100644 --- a/google/firestore/v1/firestore.proto +++ b/google/firestore/v1/firestore.proto @@ -40,20 +40,12 @@ option php_namespace = "Google\\Cloud\\Firestore\\V1"; // The Cloud Firestore service. // -// This service exposes several types of comparable timestamps: -// -// * `create_time` - The time at which a document was created. Changes only -// when a document is deleted, then re-created. Increases in a strict -// monotonic fashion. -// * `update_time` - The time at which a document was last updated. Changes -// every time a document is modified. Does not change when a write results -// in no modifications. Increases in a strict monotonic fashion. -// * `read_time` - The time at which a particular state was observed. Used -// to denote a consistent snapshot of the database or the time at which a -// Document was observed to not exist. -// * `commit_time` - The time at which the writes in a transaction were -// committed. Any read with an equal or greater `read_time` is guaranteed -// to see the effects of the transaction. +// Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL +// document database that simplifies storing, syncing, and querying data for +// your mobile, web, and IoT apps at global scale. Its client libraries provide +// live synchronization and offline support, while its security features and +// integrations with Firebase and Google Cloud Platform (GCP) accelerate +// building truly serverless apps. service Firestore { option (google.api.default_host) = "firestore.googleapis.com"; option (google.api.oauth_scopes) = @@ -425,7 +417,8 @@ message CommitResponse { // request. repeated WriteResult write_results = 1; - // The time at which the commit occurred. + // The time at which the commit occurred. Any read with an equal or greater + // `read_time` is guaranteed to see the effects of the commit. google.protobuf.Timestamp commit_time = 2; } @@ -566,7 +559,8 @@ message WriteResponse { // request. repeated WriteResult write_results = 3; - // The time at which the commit occurred. + // The time at which the commit occurred. Any read with an equal or greater + // `read_time` is guaranteed to see the effects of the write. google.protobuf.Timestamp commit_time = 4; } diff --git a/google/firestore/v1/firestore_grpc_service_config.json b/google/firestore/v1/firestore_grpc_service_config.json index 0c6f86d9..d12fb697 100755 --- a/google/firestore/v1/firestore_grpc_service_config.json +++ b/google/firestore/v1/firestore_grpc_service_config.json @@ -35,6 +35,7 @@ "maxBackoff": "60s", "backoffMultiplier": 1.3, "retryableStatusCodes": [ + "ABORTED", "UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED" @@ -55,6 +56,7 @@ "maxBackoff": "60s", "backoffMultiplier": 1.3, "retryableStatusCodes": [ + "ABORTED", "UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED" @@ -104,6 +106,7 @@ "maxBackoff": "60s", "backoffMultiplier": 1.3, "retryableStatusCodes": [ + "ABORTED", "UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED" diff --git a/google/firestore/v1/query.proto b/google/firestore/v1/query.proto index 12d80b25..fa34daf7 100644 --- a/google/firestore/v1/query.proto +++ b/google/firestore/v1/query.proto @@ -155,18 +155,6 @@ message StructuredQuery { Direction direction = 2; } - // A sort direction. - enum Direction { - // Unspecified. - DIRECTION_UNSPECIFIED = 0; - - // Ascending. - ASCENDING = 1; - - // Descending. - DESCENDING = 2; - } - // A reference to a field, such as `max(messages.time) as max_time`. message FieldReference { string field_path = 2; @@ -181,6 +169,18 @@ message StructuredQuery { repeated FieldReference fields = 2; } + // A sort direction. + enum Direction { + // Unspecified. + DIRECTION_UNSPECIFIED = 0; + + // Ascending. + ASCENDING = 1; + + // Descending. + DESCENDING = 2; + } + // The projection to return. Projection select = 1; diff --git a/google/firestore/v1/write.proto b/google/firestore/v1/write.proto index 51d92391..9ab9cd4c 100644 --- a/google/firestore/v1/write.proto +++ b/google/firestore/v1/write.proto @@ -60,6 +60,13 @@ message Write { // The field paths in this mask must not contain a reserved field name. DocumentMask update_mask = 3; + // The transforms to perform after update. + // + // This field can be set only when the operation is `update`. If present, this + // write is equivalent to performing `update` and `transform` to the same + // document atomically and in order. + repeated DocumentTransform.FieldTransform update_transforms = 7; + // An optional precondition on the document. // // The write will fail if this is set and not met by the target document.