Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable last_scanned_row_responses feature flag #1862

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.20.0')
implementation platform('com.google.cloud:libraries-bom:26.21.0')

implementation 'com.google.cloud:google-cloud-bigtable'
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,8 @@ private Builder() {
.setTotalTimeout(PRIME_REQUEST_TIMEOUT)
.build());

featureFlags = FeatureFlags.newBuilder().setReverseScans(true);
featureFlags =
FeatureFlags.newBuilder().setReverseScans(true).setLastScannedRowResponses(true);
}

private Builder(EnhancedBigtableStubSettings settings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public void testFeatureFlags() throws InterruptedException, IOException, Executi
FeatureFlags.parseFrom(BaseEncoding.base64Url().decode(encodedFeatureFlags));

assertThat(featureFlags.getReverseScans()).isTrue();
assertThat(featureFlags.getLastScannedRowResponses()).isTrue();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@
public class RowMergingCallableTest {
@Test
public void scanMarker() {
ReadRowsResponse.Builder rrr = ReadRowsResponse.newBuilder();
rrr.addChunksBuilder()
.setRowKey(ByteString.copyFromUtf8("key0"))
.setFamilyName(StringValue.of("f1"))
.setQualifier(BytesValue.of(ByteString.copyFromUtf8("q1")))
.setCommitRow(true);

FakeStreamingApi.ServerStreamingStashCallable<ReadRowsRequest, ReadRowsResponse> inner =
new ServerStreamingStashCallable<>(
Lists.newArrayList(
// send a row
rrr.build(),
// send a scan marker
ReadRowsResponse.newBuilder()
.setLastScannedRowKey(ByteString.copyFromUtf8("key1"))
Expand All @@ -56,6 +65,15 @@ public void scanMarker() {

Truth.assertThat(results)
.containsExactly(
Row.create(
ByteString.copyFromUtf8("key0"),
Lists.newArrayList(
RowCell.create(
"f1",
ByteString.copyFromUtf8("q1"),
0,
Lists.newArrayList(),
ByteString.EMPTY))),
Row.create(ByteString.copyFromUtf8("key1"), Lists.<RowCell>newArrayList()));
}

Expand Down