Skip to content

Commit

Permalink
BigtableIO: Force minimum value of desiredBundleSizeBytes to be 1 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
joar authored Oct 5, 2023
1 parent 0304cae commit c2d7d5f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
34 changes: 34 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,40 @@
* ([#X](https://github.com/apache/beam/issues/X)).
-->

# [2.52.0] - Unreleased

## Highlights

* New highly anticipated feature X added to Python SDK ([#X](https://github.com/apache/beam/issues/X)).
* New highly anticipated feature Y added to Java SDK ([#Y](https://github.com/apache/beam/issues/Y)).

## I/Os

* Support for X source added (Java/Python) ([#X](https://github.com/apache/beam/issues/X)).

## New Features / Improvements

* X feature added (Java/Python) ([#X](https://github.com/apache/beam/issues/X)).

## Breaking Changes

* X behavior was changed ([#X](https://github.com/apache/beam/issues/X)).

## Deprecations

* X behavior is deprecated and will be removed in X versions ([#X](https://github.com/apache/beam/issues/X)).

## Bugfixes

* Fixed "Desired bundle size 0 bytes must be greater than 0" in Java SDK's BigtableIO.BigtableSource when you have more cores than bytes to read (Java) [#28793](https://github.com/apache/beam/issues/28793).

## Security Fixes
* Fixed (CVE-YYYY-NNNN)[https://www.cve.org/CVERecord?id=CVE-YYYY-NNNN] (Java/Python/Go) ([#X](https://github.com/apache/beam/issues/X)).

## Known Issues

* ([#X](https://github.com/apache/beam/issues/X)).

# [2.51.0] - Unreleased

## Highlights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,11 @@ public List<BigtableSource> split(long desiredBundleSizeBytes, PipelineOptions o
long maximumNumberOfSplits = 4000;
long sizeEstimate = getEstimatedSizeBytes(options);
desiredBundleSizeBytes =
Math.max(sizeEstimate / maximumNumberOfSplits, desiredBundleSizeBytes);
Math.max(
sizeEstimate / maximumNumberOfSplits,
// BoundedReadEvaluatorFactory may provide us with a desiredBundleSizeBytes of 0
// https://github.com/apache/beam/issues/28793
Math.max(1, desiredBundleSizeBytes));

// Delegate to testable helper.
List<BigtableSource> splits =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,39 @@ public void testReadingWithSplits() throws Exception {
assertSourcesEqualReferenceSource(source, splits, null /* options */);
}

/**
* Regression test for <a href="https://github.com/apache/beam/issues/28793">[Bug]: BigtableSource
* "Desired bundle size 0 bytes must be greater than 0" #28793 </a>.
*/
@Test
public void testSplittingWithDesiredBundleSizeZero() throws Exception {
final String table = "TEST-SPLIT-DESIRED-BUNDLE-SIZE-ZERO-TABLE";
final int numRows = 10;
final int numSamples = 10;
final long bytesPerRow = 1L;

// Set up test table data and sample row keys for size estimation and splitting.
makeTableData(table, numRows);
service.setupSampleRowKeys(table, numSamples, bytesPerRow);

// Generate source and split it.
BigtableSource source =
new BigtableSource(
factory,
configId,
config,
BigtableReadOptions.builder()
.setTableId(StaticValueProvider.of(table))
.setKeyRanges(ALL_KEY_RANGE)
.build(),
null /*size*/);
List<BigtableSource> splits = source.split(0, null /* options */);

// Test num splits and split equality.
assertThat(splits, hasSize(numSamples));
assertSourcesEqualReferenceSource(source, splits, null /* options */);
}

@Test
public void testReadingWithSplitFailed() throws Exception {
FailureBigtableService failureService =
Expand Down

0 comments on commit c2d7d5f

Please sign in to comment.