Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit d818f31

Browse files
authored
Merge branch 'main' into chore/cleanup-release-please
2 parents 13cf29c + bb82f9e commit d818f31

67 files changed

Lines changed: 1809 additions & 904 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/hermetic_library_generation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
fetch-depth: 0
3939
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
40-
- uses: googleapis/sdk-platform-java/.github/scripts@v2.64.1
40+
- uses: googleapis/sdk-platform-java/.github/scripts@v2.64.2
4141
if: env.SHOULD_RUN == 'true'
4242
with:
4343
base_ref: ${{ github.base_ref }}

.github/workflows/unmanaged_dependency_check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
# repository
1818
.kokoro/build.sh
1919
- name: Unmanaged dependency check
20-
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.54.1
20+
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.54.2
2121
with:
2222
bom-path: google-cloud-spanner-bom/pom.xml

google-cloud-spanner-bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.google.cloud</groupId>
1010
<artifactId>sdk-platform-java-config</artifactId>
11-
<version>3.54.1</version>
11+
<version>3.54.2</version>
1212
</parent>
1313

1414
<name>Google Cloud Spanner BOM</name>

google-cloud-spanner-executor/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
</exclusion>
6060
</exclusions>
6161
</dependency>
62+
<dependency>
63+
<groupId>com.google.cloud</groupId>
64+
<artifactId>grpc-gcp</artifactId>
65+
<version>${grpc.gcp.version}</version>
66+
</dependency>
6267
<dependency>
6368
<groupId>io.opentelemetry.semconv</groupId>
6469
<artifactId>opentelemetry-semconv</artifactId>
@@ -296,7 +301,7 @@
296301
<groupId>org.apache.maven.plugins</groupId>
297302
<artifactId>maven-dependency-plugin</artifactId>
298303
<configuration>
299-
<ignoredDependencies> com.google.api:gax,org.apache.maven.surefire:surefire-junit4,io.opentelemetry.semconv:opentelemetry-semconv,com.google.cloud.opentelemetry:shared-resourcemapping </ignoredDependencies>
304+
<ignoredDependencies> com.google.api:gax,org.apache.maven.surefire:surefire-junit4,io.opentelemetry.semconv:opentelemetry-semconv,com.google.cloud.opentelemetry:shared-resourcemapping,com.google.cloud:grpc-gcp </ignoredDependencies>
300305
</configuration>
301306
</plugin>
302307
</plugins>

google-cloud-spanner/clirr-ignored-differences.xml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,4 +1062,81 @@
10621062
<className>com/google/cloud/spanner/connection/Connection</className>
10631063
<method>java.lang.Object getConnectionPropertyValue(com.google.cloud.spanner.connection.ConnectionProperty)</method>
10641064
</difference>
1065+
<!-- (Remove since these methods has no usage. CompositeTracer interface is annotated as internal API) -->
1066+
<difference>
1067+
<differenceType>7002</differenceType>
1068+
<className>com/google/cloud/spanner/CompositeTracer</className>
1069+
<method>void recordAFELatency(java.lang.Long)</method>
1070+
</difference>
1071+
<difference>
1072+
<differenceType>7002</differenceType>
1073+
<className>com/google/cloud/spanner/CompositeTracer</className>
1074+
<method>void recordAFELatency(java.lang.Float)</method>
1075+
</difference>
1076+
<difference>
1077+
<differenceType>7002</differenceType>
1078+
<className>com/google/cloud/spanner/CompositeTracer</className>
1079+
<method>void recordAfeHeaderMissingCount(java.lang.Long)</method>
1080+
</difference>
1081+
<difference>
1082+
<differenceType>7002</differenceType>
1083+
<className>com/google/cloud/spanner/CompositeTracer</className>
1084+
<method>void recordGFELatency(java.lang.Long)</method>
1085+
</difference>
1086+
<difference>
1087+
<differenceType>7002</differenceType>
1088+
<className>com/google/cloud/spanner/CompositeTracer</className>
1089+
<method>void recordGFELatency(java.lang.Float)</method>
1090+
</difference>
1091+
<difference>
1092+
<differenceType>7002</differenceType>
1093+
<className>com/google/cloud/spanner/CompositeTracer</className>
1094+
<method>void recordGfeHeaderMissingCount(java.lang.Long)</method>
1095+
</difference>
1096+
1097+
<difference>
1098+
<differenceType>7002</differenceType>
1099+
<className>com/google/cloud/spanner/SpannerException</className>
1100+
<method>void setRequestId(com.google.cloud.spanner.XGoogSpannerRequestId)</method>
1101+
</difference>
1102+
<difference>
1103+
<differenceType>7002</differenceType>
1104+
<className>com/google/cloud/spanner/SpannerExceptionFactory</className>
1105+
<method>com.google.cloud.spanner.SpannerBatchUpdateException newSpannerBatchUpdateException(com.google.cloud.spanner.ErrorCode, java.lang.String, long[], com.google.cloud.spanner.XGoogSpannerRequestId)</method>
1106+
</difference>
1107+
<difference>
1108+
<differenceType>7002</differenceType>
1109+
<className>com/google/cloud/spanner/SpannerExceptionFactory</className>
1110+
<method>com.google.cloud.spanner.SpannerException newSpannerException(com.google.cloud.spanner.ErrorCode, java.lang.String, java.lang.Throwable, com.google.cloud.spanner.XGoogSpannerRequestId)</method>
1111+
</difference>
1112+
<difference>
1113+
<differenceType>7002</differenceType>
1114+
<className>com/google/cloud/spanner/SpannerExceptionFactory</className>
1115+
<method>com.google.cloud.spanner.SpannerException newSpannerException(com.google.cloud.spanner.ErrorCode, java.lang.String, com.google.cloud.spanner.XGoogSpannerRequestId)</method>
1116+
</difference>
1117+
<difference>
1118+
<differenceType>7002</differenceType>
1119+
<className>com/google/cloud/spanner/SpannerExceptionFactory</className>
1120+
<method>com.google.cloud.spanner.SpannerException newSpannerException(java.lang.Throwable, com.google.cloud.spanner.XGoogSpannerRequestId)</method>
1121+
</difference>
1122+
<difference>
1123+
<differenceType>7002</differenceType>
1124+
<className>com/google/cloud/spanner/SpannerExceptionFactory</className>
1125+
<method>com.google.cloud.spanner.SpannerException newSpannerException(io.grpc.Context, java.lang.Throwable, com.google.cloud.spanner.XGoogSpannerRequestId)</method>
1126+
</difference>
1127+
<difference>
1128+
<differenceType>7002</differenceType>
1129+
<className>com/google/cloud/spanner/SpannerExceptionFactory</className>
1130+
<method>com.google.cloud.spanner.SpannerException propagateInterrupt(java.lang.InterruptedException, com.google.cloud.spanner.XGoogSpannerRequestId)</method>
1131+
</difference>
1132+
<difference>
1133+
<differenceType>6001</differenceType>
1134+
<className>com/google/cloud/spanner/XGoogSpannerRequestId</className>
1135+
<field>REQUEST_HEADER_KEY</field>
1136+
</difference>
1137+
<difference>
1138+
<differenceType>6001</differenceType>
1139+
<className>com/google/cloud/spanner/XGoogSpannerRequestId</className>
1140+
<field>REQUEST_ID</field>
1141+
</difference>
10651142
</differences>

google-cloud-spanner/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
<dependency>
167167
<groupId>com.google.cloud</groupId>
168168
<artifactId>grpc-gcp</artifactId>
169+
<version>${grpc.gcp.version}</version>
169170
</dependency>
170171
<dependency>
171172
<groupId>io.grpc</groupId>

google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbortedException.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,16 @@ public class AbortedException extends SpannerException {
3838
/** Private constructor. Use {@link SpannerExceptionFactory} to create instances. */
3939
AbortedException(
4040
DoNotConstructDirectly token, @Nullable String message, @Nullable Throwable cause) {
41-
this(token, message, cause, null, null);
41+
this(token, message, cause, null);
4242
}
4343

4444
/** Private constructor. Use {@link SpannerExceptionFactory} to create instances. */
4545
AbortedException(
4646
DoNotConstructDirectly token,
4747
@Nullable String message,
4848
@Nullable Throwable cause,
49-
@Nullable ApiException apiException,
50-
@Nullable XGoogSpannerRequestId reqId) {
51-
super(token, ErrorCode.ABORTED, IS_RETRYABLE, message, cause, apiException, reqId);
49+
@Nullable ApiException apiException) {
50+
super(token, ErrorCode.ABORTED, IS_RETRYABLE, message, cause, apiException);
5251
if (cause instanceof AbortedException) {
5352
this.transactionID = ((AbortedException) cause).getTransactionID();
5453
}

google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -457,30 +457,22 @@ void initTransaction() {
457457
}
458458

459459
private void initTransactionInternal(BeginTransactionRequest request) {
460-
XGoogSpannerRequestId reqId =
461-
session.getRequestIdCreator().nextRequestId(session.getChannel(), 1);
462460
try {
463461
Transaction transaction =
464-
rpc.beginTransaction(
465-
request, reqId.withOptions(getTransactionChannelHint()), isRouteToLeader());
462+
rpc.beginTransaction(request, getTransactionChannelHint(), isRouteToLeader());
466463
if (!transaction.hasReadTimestamp()) {
467464
throw SpannerExceptionFactory.newSpannerException(
468-
ErrorCode.INTERNAL,
469-
"Missing expected transaction.read_timestamp metadata field",
470-
reqId);
465+
ErrorCode.INTERNAL, "Missing expected transaction.read_timestamp metadata field");
471466
}
472467
if (transaction.getId().isEmpty()) {
473468
throw SpannerExceptionFactory.newSpannerException(
474-
ErrorCode.INTERNAL, "Missing expected transaction.id metadata field", reqId);
469+
ErrorCode.INTERNAL, "Missing expected transaction.id metadata field");
475470
}
476471
try {
477472
timestamp = Timestamp.fromProto(transaction.getReadTimestamp());
478473
} catch (IllegalArgumentException e) {
479474
throw SpannerExceptionFactory.newSpannerException(
480-
ErrorCode.INTERNAL,
481-
"Bad value in transaction.read_timestamp metadata field",
482-
e,
483-
reqId);
475+
ErrorCode.INTERNAL, "Bad value in transaction.read_timestamp metadata field", e);
484476
}
485477
transactionId = transaction.getId();
486478
span.addAnnotation(
@@ -816,7 +808,8 @@ ResultSet executeQueryInternalWithOptions(
816808
@Override
817809
CloseableIterator<PartialResultSet> startStream(
818810
@Nullable ByteString resumeToken,
819-
AsyncResultSet.StreamMessageListener streamListener) {
811+
AsyncResultSet.StreamMessageListener streamListener,
812+
XGoogSpannerRequestId requestId) {
820813
GrpcStreamIterator stream =
821814
new GrpcStreamIterator(
822815
statement,
@@ -839,12 +832,12 @@ CloseableIterator<PartialResultSet> startStream(
839832
if (selector != null) {
840833
request.setTransaction(selector);
841834
}
842-
this.ensureNonNullXGoogRequestId();
843835
SpannerRpc.StreamingCall call =
844836
rpc.executeQuery(
845837
request.build(),
846838
stream.consumer(),
847-
this.xGoogRequestId.withOptions(getTransactionChannelHint()),
839+
getTransactionChannelHint(),
840+
requestId,
848841
isRouteToLeader());
849842
session.markUsed(clock.instant());
850843
stream.setCall(call, request.getTransaction().hasBegin());
@@ -860,7 +853,7 @@ boolean prepareIteratorForRetryOnDifferentGrpcChannel() {
860853
stream, this, options.hasDecodeMode() ? options.decodeMode() : defaultDecodeMode);
861854
}
862855

863-
Map<SpannerRpc.Option, ?> getChannelHintOptions(
856+
static Map<SpannerRpc.Option, ?> getChannelHintOptions(
864857
Map<SpannerRpc.Option, ?> channelHintForSession, Long channelHintForTransaction) {
865858
if (channelHintForSession != null) {
866859
return channelHintForSession;
@@ -1030,7 +1023,8 @@ ResultSet readInternalWithOptions(
10301023
@Override
10311024
CloseableIterator<PartialResultSet> startStream(
10321025
@Nullable ByteString resumeToken,
1033-
AsyncResultSet.StreamMessageListener streamListener) {
1026+
AsyncResultSet.StreamMessageListener streamListener,
1027+
XGoogSpannerRequestId requestId) {
10341028
GrpcStreamIterator stream =
10351029
new GrpcStreamIterator(
10361030
lastStatement, prefetchChunks, cancelQueryWhenClientIsClosed);
@@ -1048,13 +1042,12 @@ CloseableIterator<PartialResultSet> startStream(
10481042
builder.setTransaction(selector);
10491043
}
10501044
builder.setRequestOptions(buildRequestOptions(readOptions));
1051-
this.incrementXGoogRequestIdAttempt();
1052-
this.xGoogRequestId.setChannelId(session.getChannel());
10531045
SpannerRpc.StreamingCall call =
10541046
rpc.read(
10551047
builder.build(),
10561048
stream.consumer(),
1057-
this.xGoogRequestId.withOptions(getTransactionChannelHint()),
1049+
getTransactionChannelHint(),
1050+
requestId,
10581051
isRouteToLeader());
10591052
session.markUsed(clock.instant());
10601053
stream.setCall(call, /* withBeginTransaction= */ builder.getTransaction().hasBegin());

google-cloud-spanner/src/main/java/com/google/cloud/spanner/AdminRequestsPerMinuteExceededException.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ public class AdminRequestsPerMinuteExceededException extends SpannerException {
3232
/** Private constructor. Use {@link SpannerExceptionFactory} to create instances. */
3333
AdminRequestsPerMinuteExceededException(
3434
DoNotConstructDirectly token, @Nullable String message, @Nullable Throwable cause) {
35-
this(token, message, cause, null, null);
35+
this(token, message, cause, null);
3636
}
3737

3838
/** Private constructor. Use {@link SpannerExceptionFactory} to create instances. */
3939
AdminRequestsPerMinuteExceededException(
4040
DoNotConstructDirectly token,
4141
@Nullable String message,
4242
@Nullable Throwable cause,
43-
@Nullable ApiException apiException,
44-
@Nullable XGoogSpannerRequestId reqId) {
45-
super(token, ErrorCode.RESOURCE_EXHAUSTED, true, message, cause, apiException, reqId);
43+
@Nullable ApiException apiException) {
44+
super(token, ErrorCode.RESOURCE_EXHAUSTED, true, message, cause, apiException);
4645
}
4746
}

google-cloud-spanner/src/main/java/com/google/cloud/spanner/BatchClientImpl.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,9 @@ private List<Partition> partitionReadUsingIndex(
250250
}
251251
builder.setPartitionOptions(pbuilder.build());
252252

253-
XGoogSpannerRequestId reqId =
254-
session.getRequestIdCreator().nextRequestId(session.getChannel(), 1);
255253
final PartitionReadRequest request = builder.build();
256254
try {
257-
PartitionResponse response = rpc.partitionRead(request, reqId.withOptions(options));
255+
PartitionResponse response = rpc.partitionRead(request, options);
258256
ImmutableList.Builder<Partition> partitions = ImmutableList.builder();
259257
for (com.google.spanner.v1.Partition p : response.getPartitionsList()) {
260258
Partition partition =
@@ -274,7 +272,6 @@ private List<Partition> partitionReadUsingIndex(
274272
return partitionReadUsingIndex(
275273
partitionOptions, table, index, keys, columns, true, option);
276274
}
277-
e.setRequestId(reqId);
278275
throw e;
279276
}
280277
}
@@ -316,11 +313,9 @@ private List<Partition> partitionQuery(
316313
}
317314
builder.setPartitionOptions(pbuilder.build());
318315

319-
XGoogSpannerRequestId reqId =
320-
session.getRequestIdCreator().nextRequestId(session.getChannel(), 1);
321316
final PartitionQueryRequest request = builder.build();
322317
try {
323-
PartitionResponse response = rpc.partitionQuery(request, reqId.withOptions(options));
318+
PartitionResponse response = rpc.partitionQuery(request, options);
324319
ImmutableList.Builder<Partition> partitions = ImmutableList.builder();
325320
for (com.google.spanner.v1.Partition p : response.getPartitionsList()) {
326321
Partition partition =
@@ -333,7 +328,6 @@ private List<Partition> partitionQuery(
333328
if (!isFallback && maybeMarkUnimplementedForPartitionedOps(e)) {
334329
return partitionQuery(partitionOptions, statement, true, option);
335330
}
336-
e.setRequestId(reqId);
337331
throw e;
338332
}
339333
}

0 commit comments

Comments
 (0)