jiangzzhu commented on code in PR #40870:
URL: https://github.com/apache/beam/pull/40870#discussion_r4446656250


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/action/DetectNewPartitionsAction.java:
##########
@@ -155,14 +159,18 @@ private ProcessContinuation schedulePartitions(
     for (Map.Entry<Timestamp, List<PartitionMetadata>> batch : 
batches.entrySet()) {
       numTimestampsHandledSofar++;
       final Timestamp batchCreatedAt = batch.getKey();
+      if (!tracker.tryClaim(batchCreatedAt)) {

Review Comment:
   Thanks for catching this! Agreed — performing work or emitting outputs after 
`tryClaim` returns `false` violates the `RestrictionTracker` contract.
   
   Updated per (1) to keep the existing 200-partition batching and move 
`updateBatchToScheduled` to after `tryClaim(batchCreatedAt)` succeeds. Also 
overrode `DetectNewPartitionsRangeTracker.trySplit` to return `null` when 
`fractionOfRemainder != 0` (matching Bigtable Change Streams' 
`DetectNewPartitionsTracker`), so only checkpoints (`fractionOfRemainder == 0`) 
split the coordinator restriction and a split can never bisect an unclaimed 
cross-timestamp batch or spawn an idle future restriction. PTAL!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to