Skip to content

Commit fbf6cbb

Browse files
authored
Merge branch 'main' into protobuf-ci-4.29.x
2 parents 47775a0 + e17ada2 commit fbf6cbb

File tree

35 files changed

+1314
-210
lines changed

35 files changed

+1314
-210
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
1919
<dependency>
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>libraries-bom</artifactId>
22-
<version>26.56.0</version>
22+
<version>26.59.0</version>
2323
<type>pom</type>
2424
<scope>import</scope>
2525
</dependency>
2626
<dependency>
2727
<groupId>io.opentelemetry</groupId>
2828
<artifactId>opentelemetry-bom</artifactId>
29-
<version>1.48.0</version>
29+
<version>1.49.0</version>
3030
<type>pom</type>
3131
<scope>import</scope>
3232
</dependency>
@@ -48,15 +48,15 @@ If you are using Maven without the BOM, add this to your dependencies:
4848
<dependency>
4949
<groupId>com.google.cloud</groupId>
5050
<artifactId>google-cloud-bigquerystorage</artifactId>
51-
<version>3.11.4</version>
51+
<version>3.12.0</version>
5252
</dependency>
5353

5454
```
5555

5656
If you are using Gradle 5.x or later, add this to your dependencies:
5757

5858
```Groovy
59-
implementation platform('com.google.cloud:libraries-bom:26.56.0')
59+
implementation platform('com.google.cloud:libraries-bom:26.59.0')
6060
6161
implementation 'com.google.cloud:google-cloud-bigquerystorage'
6262
```

generation_config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
gapic_generator_version: 2.55.1
2-
googleapis_commitish: 803b23488149d2d00725edc52d8a6498b6ab0fec
3-
libraries_bom_version: 26.56.0
2+
googleapis_commitish: 1c153adc542b4c915eeab5290bc42581c821cc93
3+
libraries_bom_version: 26.59.0
44
libraries:
55
- api_shortname: bigquerystorage
66
name_pretty: BigQuery Storage

google-cloud-bigquerystorage-bom/pom.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-bigquerystorage-bom</artifactId>
6-
<version>3.12.0</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
6+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
77
<packaging>pom</packaging>
88
<parent>
99
<groupId>com.google.cloud</groupId>
@@ -52,47 +52,47 @@
5252
<dependency>
5353
<groupId>com.google.cloud</groupId>
5454
<artifactId>google-cloud-bigquerystorage</artifactId>
55-
<version>3.12.0</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
55+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
5656
</dependency>
5757
<dependency>
5858
<groupId>com.google.api.grpc</groupId>
5959
<artifactId>grpc-google-cloud-bigquerystorage-v1beta1</artifactId>
60-
<version>0.184.0</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1beta1:current} -->
60+
<version>0.184.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1beta1:current} -->
6161
</dependency>
6262
<dependency>
6363
<groupId>com.google.api.grpc</groupId>
6464
<artifactId>grpc-google-cloud-bigquerystorage-v1beta2</artifactId>
65-
<version>0.184.0</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1beta2:current} -->
65+
<version>0.184.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1beta2:current} -->
6666
</dependency>
6767
<dependency>
6868
<groupId>com.google.api.grpc</groupId>
6969
<artifactId>grpc-google-cloud-bigquerystorage-v1</artifactId>
70-
<version>3.12.0</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1:current} -->
70+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1:current} -->
7171
</dependency>
7272
<dependency>
7373
<groupId>com.google.api.grpc</groupId>
7474
<artifactId>grpc-google-cloud-bigquerystorage-v1alpha</artifactId>
75-
<version>3.12.0</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1alpha:current} -->
75+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1alpha:current} -->
7676
</dependency>
7777
<dependency>
7878
<groupId>com.google.api.grpc</groupId>
7979
<artifactId>proto-google-cloud-bigquerystorage-v1beta1</artifactId>
80-
<version>0.184.0</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1beta1:current} -->
80+
<version>0.184.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1beta1:current} -->
8181
</dependency>
8282
<dependency>
8383
<groupId>com.google.api.grpc</groupId>
8484
<artifactId>proto-google-cloud-bigquerystorage-v1beta2</artifactId>
85-
<version>0.184.0</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1beta2:current} -->
85+
<version>0.184.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1beta2:current} -->
8686
</dependency>
8787
<dependency>
8888
<groupId>com.google.api.grpc</groupId>
8989
<artifactId>proto-google-cloud-bigquerystorage-v1</artifactId>
90-
<version>3.12.0</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1:current} -->
90+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1:current} -->
9191
</dependency>
9292
<dependency>
9393
<groupId>com.google.api.grpc</groupId>
9494
<artifactId>proto-google-cloud-bigquerystorage-v1alpha</artifactId>
95-
<version>3.12.0</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1alpha:current} -->
95+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1alpha:current} -->
9696
</dependency>
9797
</dependencies>
9898
</dependencyManagement>

google-cloud-bigquerystorage/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-bigquerystorage</artifactId>
6-
<version>3.12.0</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
6+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
77
<packaging>jar</packaging>
88
<name>BigQuery Storage</name>
99
<url>https://github.com/googleapis/java-bigquerystorage</url>
1010
<description>BigQuery Storage</description>
1111
<parent>
1212
<groupId>com.google.cloud</groupId>
1313
<artifactId>google-cloud-bigquerystorage-parent</artifactId>
14-
<version>3.12.0</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
14+
<version>3.12.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
1515
</parent>
1616
<properties>
1717
<site.installationModule>google-cloud-bigquerystorage</site.installationModule>

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/ConnectionWorker.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,31 +1273,38 @@ private void doneCallback(Throwable finalStatus) {
12731273
+ writerId
12741274
+ " Final status: "
12751275
+ finalStatus.toString());
1276+
boolean closedIdleConnection =
1277+
finalStatus.toString().contains("Closing the stream because it has been inactive");
12761278
this.lock.lock();
12771279
try {
12781280
this.streamConnectionIsConnected = false;
12791281
this.telemetryMetrics.recordConnectionEnd(
12801282
Code.values()[Status.fromThrowable(finalStatus).getCode().ordinal()].toString());
12811283
if (connectionFinalStatus == null) {
1282-
if (connectionRetryStartTime == 0) {
1284+
if (!closedIdleConnection && connectionRetryStartTime == 0) {
12831285
connectionRetryStartTime = System.currentTimeMillis();
12841286
}
12851287
// If the error can be retried, don't set it here, let it try to retry later on.
12861288
if (isConnectionErrorRetriable(Status.fromThrowable(finalStatus).getCode())
12871289
&& !userClosed
12881290
&& (maxRetryDuration.toMillis() == 0f
1291+
|| closedIdleConnection
12891292
|| System.currentTimeMillis() - connectionRetryStartTime
12901293
<= maxRetryDuration.toMillis())) {
1291-
this.conectionRetryCountWithoutCallback++;
1292-
this.telemetryMetrics.recordConnectionStartWithRetry();
1294+
if (!closedIdleConnection) {
1295+
this.conectionRetryCountWithoutCallback++;
1296+
this.telemetryMetrics.recordConnectionStartWithRetry();
1297+
}
12931298
log.info(
12941299
"Connection is going to be reestablished with the next request. Retriable error "
12951300
+ finalStatus.toString()
12961301
+ " received, retry count "
12971302
+ conectionRetryCountWithoutCallback
12981303
+ ", millis left to retry "
12991304
+ (maxRetryDuration.toMillis()
1300-
- (System.currentTimeMillis() - connectionRetryStartTime))
1305+
- (connectionRetryStartTime > 0
1306+
? System.currentTimeMillis() - connectionRetryStartTime
1307+
: 0))
13011308
+ ", for stream "
13021309
+ streamName
13031310
+ " id:"
@@ -1311,7 +1318,10 @@ private void doneCallback(Throwable finalStatus) {
13111318
+ " for stream "
13121319
+ streamName
13131320
+ " with write id: "
1314-
+ writerId);
1321+
+ writerId
1322+
+ ", millis left to retry was "
1323+
+ (maxRetryDuration.toMillis()
1324+
- (System.currentTimeMillis() - connectionRetryStartTime)));
13151325
}
13161326
}
13171327
} finally {

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1alpha/MetastorePartitionServiceClient.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
4949
* .addAllRequests(new ArrayList<CreateMetastorePartitionRequest>())
5050
* .setSkipExistingPartitions(true)
51+
* .setTraceId("traceId-1067401920")
5152
* .build();
5253
* BatchCreateMetastorePartitionsResponse response =
5354
* metastorePartitionServiceClient.batchCreateMetastorePartitions(request);
@@ -251,6 +252,7 @@ public MetastorePartitionServiceStub getStub() {
251252
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
252253
* .addAllRequests(new ArrayList<CreateMetastorePartitionRequest>())
253254
* .setSkipExistingPartitions(true)
255+
* .setTraceId("traceId-1067401920")
254256
* .build();
255257
* BatchCreateMetastorePartitionsResponse response =
256258
* metastorePartitionServiceClient.batchCreateMetastorePartitions(request);
@@ -284,6 +286,7 @@ public final BatchCreateMetastorePartitionsResponse batchCreateMetastorePartitio
284286
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
285287
* .addAllRequests(new ArrayList<CreateMetastorePartitionRequest>())
286288
* .setSkipExistingPartitions(true)
289+
* .setTraceId("traceId-1067401920")
287290
* .build();
288291
* ApiFuture<BatchCreateMetastorePartitionsResponse> future =
289292
* metastorePartitionServiceClient
@@ -318,6 +321,7 @@ public final BatchCreateMetastorePartitionsResponse batchCreateMetastorePartitio
318321
* BatchDeleteMetastorePartitionsRequest.newBuilder()
319322
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
320323
* .addAllPartitionValues(new ArrayList<MetastorePartitionValues>())
324+
* .setTraceId("traceId-1067401920")
321325
* .build();
322326
* metastorePartitionServiceClient.batchDeleteMetastorePartitions(request);
323327
* }
@@ -348,6 +352,7 @@ public final void batchDeleteMetastorePartitions(BatchDeleteMetastorePartitionsR
348352
* BatchDeleteMetastorePartitionsRequest.newBuilder()
349353
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
350354
* .addAllPartitionValues(new ArrayList<MetastorePartitionValues>())
355+
* .setTraceId("traceId-1067401920")
351356
* .build();
352357
* ApiFuture<Empty> future =
353358
* metastorePartitionServiceClient
@@ -381,6 +386,7 @@ public final void batchDeleteMetastorePartitions(BatchDeleteMetastorePartitionsR
381386
* BatchUpdateMetastorePartitionsRequest.newBuilder()
382387
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
383388
* .addAllRequests(new ArrayList<UpdateMetastorePartitionRequest>())
389+
* .setTraceId("traceId-1067401920")
384390
* .build();
385391
* BatchUpdateMetastorePartitionsResponse response =
386392
* metastorePartitionServiceClient.batchUpdateMetastorePartitions(request);
@@ -413,6 +419,7 @@ public final BatchUpdateMetastorePartitionsResponse batchUpdateMetastorePartitio
413419
* BatchUpdateMetastorePartitionsRequest.newBuilder()
414420
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
415421
* .addAllRequests(new ArrayList<UpdateMetastorePartitionRequest>())
422+
* .setTraceId("traceId-1067401920")
416423
* .build();
417424
* ApiFuture<BatchUpdateMetastorePartitionsResponse> future =
418425
* metastorePartitionServiceClient
@@ -509,6 +516,7 @@ public final ListMetastorePartitionsResponse listMetastorePartitions(String pare
509516
* ListMetastorePartitionsRequest.newBuilder()
510517
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
511518
* .setFilter("filter-1274492040")
519+
* .setTraceId("traceId-1067401920")
512520
* .build();
513521
* ListMetastorePartitionsResponse response =
514522
* metastorePartitionServiceClient.listMetastorePartitions(request);
@@ -541,6 +549,7 @@ public final ListMetastorePartitionsResponse listMetastorePartitions(
541549
* ListMetastorePartitionsRequest.newBuilder()
542550
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
543551
* .setFilter("filter-1274492040")
552+
* .setTraceId("traceId-1067401920")
544553
* .build();
545554
* ApiFuture<ListMetastorePartitionsResponse> future =
546555
* metastorePartitionServiceClient.listMetastorePartitionsCallable().futureCall(request);

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1alpha/package-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
* .setParent(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString())
4141
* .addAllRequests(new ArrayList<CreateMetastorePartitionRequest>())
4242
* .setSkipExistingPartitions(true)
43+
* .setTraceId("traceId-1067401920")
4344
* .build();
4445
* BatchCreateMetastorePartitionsResponse response =
4546
* metastorePartitionServiceClient.batchCreateMetastorePartitions(request);

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/ConnectionWorkerTest.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.google.cloud.bigquery.storage.v1.ConnectionWorker.Load;
3333
import com.google.protobuf.DescriptorProtos;
3434
import com.google.protobuf.Int64Value;
35+
import io.grpc.Status;
3536
import io.grpc.StatusRuntimeException;
3637
import io.opentelemetry.api.common.Attributes;
3738
import java.io.IOException;
@@ -898,6 +899,49 @@ public void testOpenTelemetryAttributesWithTraceId() throws Exception {
898899
exerciseOpenTelemetryAttributesWithTraceId("a:b dataflow:c:d", "c", "d", null);
899900
}
900901

902+
@Test
903+
public void testDoubleDisconnectWithShorterRetryDuration() throws Exception {
904+
// simulate server disconnect due to idle stream
905+
testBigQueryWrite.setFailedStatus(
906+
Status.ABORTED.withDescription(
907+
"Closing the stream because it has been inactive for 600 seconds."));
908+
testBigQueryWrite.setCloseEveryNAppends(1);
909+
testBigQueryWrite.setTimesToClose(
910+
2); // Total of 2 connection failures. The time interval between the processing of these
911+
// failures will exceed the configured maxRetryDuration.
912+
testBigQueryWrite.addResponse(createAppendResponse(0));
913+
914+
ProtoSchema schema1 = createProtoSchema("foo");
915+
StreamWriter sw1 =
916+
StreamWriter.newBuilder(TEST_STREAM_1, client)
917+
.setLocation("us")
918+
.setWriterSchema(schema1)
919+
.build();
920+
ConnectionWorker connectionWorker =
921+
new ConnectionWorker(
922+
TEST_STREAM_1,
923+
"us",
924+
schema1,
925+
100000,
926+
100000,
927+
Duration.ofMillis(1), // very small maxRetryDuration
928+
FlowController.LimitExceededBehavior.Block,
929+
TEST_TRACE_ID,
930+
null,
931+
client.getSettings(),
932+
retrySettings,
933+
/*enableRequestProfiler=*/ false,
934+
/*enableOpenTelemetry=*/ false,
935+
/*isMultiplexing*/ false);
936+
937+
List<ApiFuture<AppendRowsResponse>> futures = new ArrayList<>();
938+
futures.add(
939+
sendTestMessage(
940+
connectionWorker, sw1, createFooProtoRows(new String[] {String.valueOf(0)}), 0));
941+
942+
assertEquals(0, futures.get(0).get().getAppendResult().getOffset().getValue());
943+
}
944+
901945
@Test
902946
public void testLocationName() throws Exception {
903947
assertEquals(

0 commit comments

Comments
 (0)