Skip to content

Commit 92b4a71

Browse files
address feedback
1 parent a8c75c3 commit 92b4a71

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static EnhancedBigtableStub create(EnhancedBigtableStubSettings settings)
8181
.setCredentialsProvider(settings.getCredentialsProvider());
8282

8383
// ReadRow retries are handled in the overlay: disable retries in the base layer (but make
84-
// sure to preserve the exception callable settings.
84+
// sure to preserve the exception callable settings).
8585
baseSettingsBuilder
8686
.readRowsSettings()
8787
.setSimpleTimeoutNoRetries(Duration.ofHours(2))

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsResumptionStrategy.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public StreamResumptionStrategy<ReadRowsRequest, RowT> createNew() {
6060
public void onProgress(RowT response) {
6161
// Last key can come from both the last processed row key and a synthetic row marker. The
6262
// synthetic row marker is emitted when the server has read a lot of data that was filtered out.
63-
// So it can trim the start of the scan, but does not contribute to the row limit.
63+
// The row marker can be used to trim the start of the scan, but does not contribute to the row
64+
// limit.
6465
lastKey = rowAdapter.getKey(response);
6566
if (!rowAdapter.isScanMarkerRow(response)) {
6667
// Only real rows count towards the rows limit.
@@ -79,15 +80,15 @@ public void onProgress(RowT response) {
7980
@Override
8081
public ReadRowsRequest getResumeRequest(ReadRowsRequest request) {
8182
// An empty lastKey means that we have not successfully read the first row,
82-
// resume with the original request object.
83+
// so resume with the original request object.
8384
if (lastKey.isEmpty()) {
8485
return request;
8586
}
8687

8788
ReadRowsRequest originalRequest = request;
8889

89-
// Special case: empty query implies full table scan, make this explicit by adding an unbounded
90-
// range to the request
90+
// Special case: empty query implies full table scan, so make this explicit by adding an
91+
// unbounded range to the request
9192
if (request.getRows().getRowKeysList().isEmpty()
9293
&& request.getRows().getRowRangesList().isEmpty()) {
9394

@@ -115,17 +116,17 @@ public ReadRowsRequest getResumeRequest(ReadRowsRequest request) {
115116

116117
switch (rowRange.getEndKeyCase()) {
117118
case END_KEY_CLOSED:
118-
if (ByteStringComparator.INSTANCE.compare(rowRange.getEndKeyClosed(), lastKey) <= 0) {
119-
continue;
120-
} else {
119+
if (ByteStringComparator.INSTANCE.compare(rowRange.getEndKeyClosed(), lastKey) > 0) {
121120
rowRangeBuilder.setEndKeyClosed(rowRange.getEndKeyClosed());
121+
} else {
122+
continue;
122123
}
123124
break;
124125
case END_KEY_OPEN:
125-
if (ByteStringComparator.INSTANCE.compare(rowRange.getEndKeyOpen(), lastKey) <= 0) {
126-
continue;
127-
} else {
126+
if (ByteStringComparator.INSTANCE.compare(rowRange.getEndKeyOpen(), lastKey) > 0) {
128127
rowRangeBuilder.setEndKeyOpen(rowRange.getEndKeyOpen());
128+
} else {
129+
continue;
129130
}
130131
break;
131132
case ENDKEY_NOT_SET:
@@ -160,8 +161,8 @@ public ReadRowsRequest getResumeRequest(ReadRowsRequest request) {
160161
}
161162

162163
// Edge case: retrying a fulfilled request.
163-
// A fulfilled request is one that has had all of its row keys and ranges fulfilled or if it had
164-
// a row limit, has seen enough rows. These requests are replaced with a marker request that
164+
// A fulfilled request is one that has had all of its row keys and ranges fulfilled, or if it
165+
// had a row limit, has seen enough rows. These requests are replaced with a marker request that
165166
// will be handled by ReadRowsRetryCompletedCallable. See docs in ReadRowsRetryCompletedCallable
166167
// for more details.
167168
if ((rowSetBuilder.getRowRangesCount() == 0 && rowSetBuilder.getRowKeysCount() == 0)

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryCompletedCallable.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
* an OK response.
2929
*
3030
* <p>This callable works in tandem with {@link ReadRowsResumptionStrategy}, which will send a
31-
* {@link #FULFILLED_REQUEST_MARKER} to be processed by this callable. Which will promptly notify
32-
* the {@link ResponseObserver} that the stream has been successfully compeleted.
31+
* {@link #FULFILLED_REQUEST_MARKER} to be processed by this callable. Upon receiving the {@link
32+
* #FULFILLED_REQUEST_MARKER}, this callable will promptly notify the {@link ResponseObserver} that
33+
* the stream has been successfully compeleted.
3334
*
3435
* <p>This class is considered an internal implementation detail and not meant to be used by
3536
* applications.

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/package-info.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
* Implementation details for {@link
1818
* com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStub#readRowsCallable()}.
1919
*
20-
* <p>The ReadRows protocol is optimized for transmission and cannot be consumed directly. This
21-
* package implements significant customizations on top of the raw GAPIC generated stub to handle
22-
* row merging and retries.
20+
* <p>The ReadRows protocol is optimized for transmission and is not designed to be consumed
21+
* directly. This package implements significant customizations on top of the raw GAPIC generated
22+
* stub to handle row merging and retries.
2323
*
2424
* <ul>
2525
* <li>ReadRowsUserCallable: Creates protobuf {@link com.google.bigtable.v2.ReadRowsRequest}s from
@@ -30,7 +30,8 @@
3030
* to be filtered out.
3131
* <li>RowMerger (+ helpers): Implements resuming retries for gax's Callables#retrying middleware.
3232
* <li>FilterMarkerRowsCallable: Filters out marker rows that are used for efficient retry
33-
* resumes. This is necessary because
33+
* resumes. The marker is an internal implementation detail to communicate state to the
34+
* RowMerger and should not be exposed to the caller.
3435
* </ul>
3536
*
3637
* <p>This package is considered an internal implementation detail and is not meant to be used by

0 commit comments

Comments
 (0)