From 86463fc1ac567c9b5cf84469c1231f4d15ce246f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Mon, 2 Nov 2026 11:29:26 +0100 Subject: [PATCH] fix(spanner): restore setCall overload for stream test compatibility Merging PR #14770 and PR #14776 concurrently broke the build on main. One PR added unit tests that configure mock streams using a two-argument setCall method to indicate whether a transaction is inlined, while the other PR removed that parameter because production code now configures this during stream construction. This change restores the two-argument setCall method for testing and keeps the inlined transaction state configurable during test setup. --- .../com/google/cloud/spanner/GrpcStreamIterator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStreamIterator.java b/java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStreamIterator.java index 7b0cb08b5c84..312e841a188c 100644 --- a/java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStreamIterator.java +++ b/java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStreamIterator.java @@ -86,7 +86,7 @@ public String toString() { private boolean callCleared; private boolean closed; @Nullable private String closeMessage; - private final boolean withBeginTransaction; + private volatile boolean withBeginTransaction; private final boolean lastStatement; @Nullable private volatile Timeout streamWaitTimeout; @Nullable private volatile SpannerException error; @@ -156,6 +156,14 @@ void registerListener(AsyncResultSet.StreamMessageListener streamMessageListener } } + @VisibleForTesting + void setCall(SpannerRpc.StreamingCall call, boolean withBeginTransaction) { + synchronized (this) { + this.withBeginTransaction = withBeginTransaction; + } + setCall(call); + } + void setCall(SpannerRpc.StreamingCall call) { Timeout timeout = extractTimeout(call); boolean shouldCancel;