diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java index 7c966a5691d3..e9245f2db3f2 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java @@ -1179,11 +1179,7 @@ CloseableIterator startStream(@Nullable ByteString resumeToken : request.toBuilder().setResumeToken(resumeToken).build(), stream.consumer(), session.options); - // StreamController does not auto-request 1 message. Kick it off mannually - call.request(1); - if (prefetchChunks > 1) { - call.request(prefetchChunks - 1); - } + call.request(prefetchChunks); stream.setCall(call); return stream; } diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java index 6e4346ab0857..ad8f654b249c 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java @@ -110,6 +110,7 @@ public class GapicSpannerRpc implements SpannerRpc { PathTemplate.create("projects/{project}"); private static final int MAX_MESSAGE_SIZE = 100 * 1024 * 1024; + // TODO(hzyi): change the stub names to be more intuitive private final SpannerStub stub; private final InstanceAdminStub instanceStub; private final DatabaseAdminStub databaseStub;