Skip to content

Commit

Permalink
fix: remove types QueryMode, QueryPlan, ResultSetStats (#1982)
Browse files Browse the repository at this point in the history
* feat: Expose the undeliverable_first_gen_event.proto

PiperOrigin-RevId: 600597791

Source-Link: googleapis/googleapis@fc15738

Source-Link: googleapis/googleapis-gen@1939fca
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTkzOWZjYWZlNTZlMmNhMDg3NjdkOTQ1MDlmYTYyNjMxOTM0YjJhMCJ9

fix: improve retry logic for streaming API calls
build: update typescript generator version to 4.3.0

The streaming API call retry logic has changed, which in some rare cases may require code changes. Please feel free to reach out to us in the issues if you experience new problems with retrying streaming calls after this update.

PiperOrigin-RevId: 599622271

Source-Link: googleapis/googleapis@6239c21

Source-Link: googleapis/googleapis-gen@da13d82
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZGExM2Q4MjIyZDNiYTMzNzM0NTAxOTk5ODY0NDU4NjQwZjE0MDVhZSJ9

chore: Add FindNearest API to the preview branch
docs: Improve the documentation on Document.fields

PiperOrigin-RevId: 599602467

Source-Link: googleapis/googleapis@d32bd97

Source-Link: googleapis/googleapis-gen@0545ffc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDU0NWZmYzQ4OGI4MmQzYTQ3NzExMThjOTIzZDY0Y2QwYjc1OTk1MyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix!: remove types QueryMode, QueryPlan, ResultSetStats
fix!: remove QueryMode field from RunQueryRequest
fix!: remove ResultSetStats field from RunQueryResponse
fix!: remove QueryMode field from RunAggregationQueryRequest
fix!: remove ResultSetStats field from RunAggregationQueryResponse

PiperOrigin-RevId: 601486523

Source-Link: googleapis/googleapis@a8b027a

Source-Link: googleapis/googleapis-gen@b9b571f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjliNTcxZjU4NTQxYzBhY2UxZmY5NGJmMjJhZjNkMDYzZWViZmI3YyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Jan 31, 2024
1 parent 98e668b commit b4f7d60
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 61 deletions.
24 changes: 12 additions & 12 deletions dev/protos/google/firestore/v1/document.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ message Document {
//
// The map keys represent field names.
//
// A simple field name contains only characters `a` to `z`, `A` to `Z`,
// `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
// `foo_bar_17`.
//
// Field names matching the regular expression `__.*__` are reserved. Reserved
// field names are forbidden except in certain documented contexts. The map
// keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
// field names are forbidden except in certain documented contexts. The field
// names, represented as UTF-8, must not exceed 1,500 bytes and cannot be
// empty.
//
// Field paths may be used in other contexts to refer to structured fields
// defined here. For `map_value`, the field path is represented by the simple
// or quoted field names of the containing fields, delimited by `.`. For
// example, the structured field
// `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
// represented by the field path `foo.x&y`.
// defined here. For `map_value`, the field path is represented by a
// dot-delimited (`.`) string of segments. Each segment is either a simple
// field name (defined below) or a quoted field name. For example, the
// structured field `"foo" : { map_value: { "x&y" : { string_value: "hello"
// }}}` would be represented by the field path `` foo.`x&y` ``.
//
// A simple field name contains only characters `a` to `z`, `A` to `Z`,
// `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
// `foo_bar_17`.
//
// Within a field path, a quoted field name starts and ends with `` ` `` and
// A quoted field name starts and ends with `` ` `` and
// may contain any character. Some characters, including `` ` ``, must be
// escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
// `` `bak\`tik` `` represents `` bak`tik ``.
Expand Down
25 changes: 0 additions & 25 deletions dev/protos/google/firestore/v1/firestore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import "google/firestore/v1/aggregation_result.proto";
import "google/firestore/v1/common.proto";
import "google/firestore/v1/document.proto";
import "google/firestore/v1/query.proto";
import "google/firestore/v1/query_profile.proto";
import "google/firestore/v1/write.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
Expand Down Expand Up @@ -577,11 +576,6 @@ message RunQueryRequest {
// minute timestamp within the past 7 days.
google.protobuf.Timestamp read_time = 7;
}

// Optional. The mode in which the query request is processed. This field is
// optional, and when not provided, it defaults to `NORMAL` mode where no
// additional statistics will be returned with the query results.
QueryMode mode = 9 [(google.api.field_behavior) = OPTIONAL];
}

// The response for
Expand Down Expand Up @@ -618,13 +612,6 @@ message RunQueryResponse {
// documents will be returned.
bool done = 6;
}

// Query plan and execution statistics. Note that the returned stats are
// subject to change as Firestore evolves.
//
// This is only present when the request specifies a mode other than `NORMAL`
// and is sent only once with the last response in the stream.
ResultSetStats stats = 7;
}

// The request for
Expand Down Expand Up @@ -664,11 +651,6 @@ message RunAggregationQueryRequest {
// minute timestamp within the past 7 days.
google.protobuf.Timestamp read_time = 6;
}

// Optional. The mode in which the query request is processed. This field is
// optional, and when not provided, it defaults to `NORMAL` mode where no
// additional statistics will be returned with the query results.
QueryMode mode = 7 [(google.api.field_behavior) = OPTIONAL];
}

// The response for
Expand All @@ -694,13 +676,6 @@ message RunAggregationQueryResponse {
// `result` will be sent, and this represents the time at which the query
// was run.
google.protobuf.Timestamp read_time = 3;

// Query plan and execution statistics. Note that the returned stats are
// subject to change as Firestore evolves.
//
// This is only present when the request specifies a mode other than `NORMAL`
// and is sent only once with the last response in the stream.
ResultSetStats stats = 6;
}

// The request for
Expand Down
8 changes: 8 additions & 0 deletions dev/protos/google/firestore/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";

// A Firestore query.
//
// The query stages are executed in the following order:
// 1. from
// 2. where
// 3. select
// 4. order_by + start_at + end_at
// 5. offset
// 6. limit
message StructuredQuery {
// A selection of a collection, such as `messages as m1`.
message CollectionSelector {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.firestore.v1beta1;

import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "UndeliverableFirstGenEventProto";
option java_package = "com.google.firestore.v1beta1";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";

// A message signifying an event that cannot be delivered to Cloud Functions
// from Firestore using [Cloud Firestore triggers 1st
// gen](https://cloud.google.com/functions/docs/calling/cloud-firestore)
message UndeliverableFirstGenEvent {
// Reason for events being undeliverable.
enum Reason {
// Unspecified.
REASON_UNSPECIFIED = 0;

// Exceeding maximum event size limit
EXCEEDING_SIZE_LIMIT = 1;
}

// Document change type.
enum DocumentChangeType {
// Unspecified.
DOCUMENT_CHANGE_TYPE_UNSPECIFIED = 0;

// Represent creation operation.
CREATE = 1;

// Represent delete operation.
DELETE = 2;

// Represent update operation.
UPDATE = 3;
}

// Error message for events being undeliverable.
string message = 1;

// Reason for events being undeliverable.
Reason reason = 2;

// The resource name of the changed document, in the format of
// `projects/{projectId}/databases/{databaseId}/documents/{document_path}`.
string document_name = 3;

// The type of the document change.
DocumentChangeType document_change_type = 4;

// The names of the functions that were supposed to be triggered.
repeated string function_name = 5;

// The commit time of triggered write operation.
google.protobuf.Timestamp triggered_time = 6;
}
2 changes: 2 additions & 0 deletions dev/protos/google/protobuf/descriptor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,10 @@ message FeatureSet {

extensions 1000; // for Protobuf C++
extensions 1001; // for Protobuf Java
extensions 1002; // for Protobuf Go

extensions 9995 to 9999; // For internal testing
extensions 10000; // for https://github.com/bufbuild/protobuf-es
}

// A compiled specification for the defaults of a set of features. These
Expand Down
23 changes: 10 additions & 13 deletions dev/src/v1/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,23 +212,28 @@ export class FirestoreClient {
this.descriptors.stream = {
batchGetDocuments: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
runQuery: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
runAggregationQuery: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
write: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.BIDI_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
listen: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.BIDI_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
};

Expand Down Expand Up @@ -1230,10 +1235,6 @@ export class FirestoreClient {
* This must be a microsecond precision timestamp within the past one hour,
* or if Point-in-Time Recovery is enabled, can additionally be a whole
* minute timestamp within the past 7 days.
* @param {google.firestore.v1.QueryMode} [request.mode]
* Optional. The mode in which the query request is processed. This field is
* optional, and when not provided, it defaults to `NORMAL` mode where no
* additional statistics will be returned with the query results.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
Expand Down Expand Up @@ -1300,10 +1301,6 @@ export class FirestoreClient {
* This must be a microsecond precision timestamp within the past one hour,
* or if Point-in-Time Recovery is enabled, can additionally be a whole
* minute timestamp within the past 7 days.
* @param {google.firestore.v1.QueryMode} [request.mode]
* Optional. The mode in which the query request is processed. This field is
* optional, and when not provided, it defaults to `NORMAL` mode where no
* additional statistics will be returned with the query results.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
Expand Down
1 change: 0 additions & 1 deletion dev/src/v1/firestore_proto_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"../../protos/google/firestore/v1/document.proto",
"../../protos/google/firestore/v1/firestore.proto",
"../../protos/google/firestore/v1/query.proto",
"../../protos/google/firestore/v1/query_profile.proto",
"../../protos/google/firestore/v1/write.proto"
]
12 changes: 8 additions & 4 deletions dev/src/v1beta1/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,23 @@ export class FirestoreClient {
this.descriptors.stream = {
batchGetDocuments: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
runQuery: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
write: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.BIDI_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
listen: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.BIDI_STREAMING,
!!opts.fallback
!!opts.fallback,
/* gaxStreamingRetries: */ true
),
};

Expand Down
1 change: 1 addition & 0 deletions dev/src/v1beta1/firestore_proto_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"../../protos/google/firestore/v1beta1/document.proto",
"../../protos/google/firestore/v1beta1/firestore.proto",
"../../protos/google/firestore/v1beta1/query.proto",
"../../protos/google/firestore/v1beta1/undeliverable_first_gen_event.proto",
"../../protos/google/firestore/v1beta1/write.proto"
]
2 changes: 1 addition & 1 deletion dev/src/v1beta1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "typescript",
"protoPackage": "google.firestore.v1beta1",
"libraryPackage": "firestore",
"libraryPackage": "@google-cloud/firestore",
"services": {
"Firestore": {
"clients": {
Expand Down
18 changes: 15 additions & 3 deletions dev/test/gapic_firestore_v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,11 @@ describe('v1.FirestoreClient', () => {
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.batchGetDocuments(request, {
retryRequestOptions: {noResponseRetries: 0},
retry: {
shouldRetryFn: () => {
return false;
},
},
});
const promise = new Promise((resolve, reject) => {
stream.on(
Expand Down Expand Up @@ -1542,7 +1546,11 @@ describe('v1.FirestoreClient', () => {
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.runQuery(request, {
retryRequestOptions: {noResponseRetries: 0},
retry: {
shouldRetryFn: () => {
return false;
},
},
});
const promise = new Promise((resolve, reject) => {
stream.on(
Expand Down Expand Up @@ -1668,7 +1676,11 @@ describe('v1.FirestoreClient', () => {
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.runAggregationQuery(request, {
retryRequestOptions: {noResponseRetries: 0},
retry: {
shouldRetryFn: () => {
return false;
},
},
});
const promise = new Promise((resolve, reject) => {
stream.on(
Expand Down
12 changes: 10 additions & 2 deletions dev/test/gapic_firestore_v1beta1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,11 @@ describe('v1beta1.FirestoreClient', () => {
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.batchGetDocuments(request, {
retryRequestOptions: {noResponseRetries: 0},
retry: {
shouldRetryFn: () => {
return false;
},
},
});
const promise = new Promise((resolve, reject) => {
stream.on(
Expand Down Expand Up @@ -1550,7 +1554,11 @@ describe('v1beta1.FirestoreClient', () => {
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.runQuery(request, {
retryRequestOptions: {noResponseRetries: 0},
retry: {
shouldRetryFn: () => {
return false;
},
},
});
const promise = new Promise((resolve, reject) => {
stream.on(
Expand Down

0 comments on commit b4f7d60

Please sign in to comment.