Skip to content

Commit 675c5de

Browse files
committed
chore(x-goog-spanner-request-id): add BeginTransaction+ResumableStreamIterator
Plumbs x-goog-spanner-request-id into BeginTransaction and ResumableStreamIterator and for PartitionedDmlTransaction. Updates #3537
1 parent 1cbc00b commit 675c5de

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ public boolean equals(Object o) {
11011101
if (this.reqId == null || other.reqId == null) {
11021102
return this.reqId == null && other.reqId == null;
11031103
}
1104-
return this.reqId.equals(other.reqId);
1104+
return Objects.equals(this.reqId, other.reqId);
11051105
}
11061106
}
11071107
}

google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,22 @@ public static void startStaticServer() throws IOException {
228228
Set<String> checkMethods =
229229
new HashSet(
230230
Arrays.asList(
231-
"google.spanner.v1.Spanner/BatchCreateSessions"
232-
// As functionality is added, uncomment each method.
233-
// "google.spanner.v1.Spanner/BatchWrite",
234-
// "google.spanner.v1.Spanner/BeginTransaction",
235-
// "google.spanner.v1.Spanner/CreateSession",
236-
// "google.spanner.v1.Spanner/DeleteSession",
237-
// "google.spanner.v1.Spanner/ExecuteBatchDml",
238-
// "google.spanner.v1.Spanner/ExecuteSql",
239-
// "google.spanner.v1.Spanner/ExecuteStreamingSql",
240-
// "google.spanner.v1.Spanner/StreamingRead",
241-
// "google.spanner.v1.Spanner/PartitionQuery",
242-
// "google.spanner.v1.Spanner/PartitionRead",
243-
// "google.spanner.v1.Spanner/Commit",
244-
));
231+
"google.spanner.v1.Spanner/BatchCreateSessions",
232+
"google.spanner.v1.Spanner/BatchWrite",
233+
"google.spanner.v1.Spanner/BeginTransaction",
234+
"google.spanner.v1.Spanner/Commit",
235+
"google.spanner.v1.Spanner/CreateSession",
236+
"google.spanner.v1.Spanner/DeleteSession",
237+
"google.spanner.v1.Spanner/ExecuteBatchDml",
238+
"google.spanner.v1.Spanner/ExecuteSql",
239+
"google.spanner.v1.Spanner/ExecuteStreamingSql",
240+
"google.spanner.v1.Spanner/GetSession",
241+
"google.spanner.v1.Spanner/ListSessions",
242+
"google.spanner.v1.Spanner/PartitionQuery",
243+
"google.spanner.v1.Spanner/PartitionRead",
244+
"google.spanner.v1.Spanner/Read",
245+
"google.spanner.v1.Spanner/Rollback",
246+
"google.spanner.v1.Spanner/StreamingRead"));
245247
xGoogReqIdInterceptor = new XGoogSpannerRequestIdTest.ServerHeaderEnforcer(checkMethods);
246248
executor = Executors.newSingleThreadExecutor();
247249
String uniqueName = InProcessServerBuilder.generateName();

google-cloud-spanner/src/test/java/com/google/cloud/spanner/PartitionedDmlTransactionTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ public class PartitionedDmlTransactionTest {
9696
public void setup() {
9797
MockitoAnnotations.initMocks(this);
9898
when(session.getName()).thenReturn(sessionId);
99+
when(session.getRequestIdCreator())
100+
.thenReturn(new XGoogSpannerRequestId.NoopRequestIdCreator());
99101
when(session.getOptions()).thenReturn(Collections.EMPTY_MAP);
100102
when(session.getRequestIdCreator())
101103
.thenReturn(new XGoogSpannerRequestId.NoopRequestIdCreator());

0 commit comments

Comments
 (0)