Skip to content

Commit cfe728e

Browse files
authored
fix(spanner): restore setCall overload for stream test compatibility (#14885)
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.
1 parent 48e1c30 commit cfe728e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStreamIterator.java‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public String toString() {
8686
private boolean callCleared;
8787
private boolean closed;
8888
@Nullable private String closeMessage;
89-
private final boolean withBeginTransaction;
89+
private volatile boolean withBeginTransaction;
9090
private final boolean lastStatement;
9191
@Nullable private volatile Timeout streamWaitTimeout;
9292
@Nullable private volatile SpannerException error;
@@ -156,6 +156,14 @@ void registerListener(AsyncResultSet.StreamMessageListener streamMessageListener
156156
}
157157
}
158158

159+
@VisibleForTesting
160+
void setCall(SpannerRpc.StreamingCall call, boolean withBeginTransaction) {
161+
synchronized (this) {
162+
this.withBeginTransaction = withBeginTransaction;
163+
}
164+
setCall(call);
165+
}
166+
159167
void setCall(SpannerRpc.StreamingCall call) {
160168
Timeout timeout = extractTimeout(call);
161169
boolean shouldCancel;

0 commit comments

Comments
 (0)