jiangzzhu opened a new pull request, #40887:
URL: https://github.com/apache/beam/pull/40887

   ## Summary
   
   - `DetectNewPartitionsDoFn` tracks partition discovery over half-open 
`TimestampRange` intervals `[from, to)`, where `from` is inclusive and `to` is 
exclusive (`TimestampRangeTracker.tryClaim(pos)` accepts `from <= pos < to`).
   - Previously, `PartitionMetadataDao.getAllPartitionsCreatedAfter(timestamp)` 
and `PartitionMetadataDao.countPartitionsCreatedAfter(timestamp)` queried 
Spanner using strict `>` (`WHERE CreatedAt > @timestamp` in GoogleSQL and 
`WHERE "CreatedAt" > $1` in PostgreSQL).
   - When a runner splits `[from, to)` into a primary `[from, T_split)` and 
residual `[T_split, to)` where a partition has `CreatedAt == T_split`, the 
primary rejects `T_split` (`tryClaim(T_split) == false`) and the residual 
skipped `T_split` (`CreatedAt > T_split`), stranding that partition in 
`CREATED` indefinitely and stalling the watermark.
   - Fix both `getAllPartitionsCreatedAfter` and `countPartitionsCreatedAfter` 
(for both GoogleSQL and PostgreSQL) to use `>=`, and update the corresponding 
Javadocs.
     - Normal SDF checkpoints remain duplicate-free on the already-claimed 
position because `TimestampRangeTracker.trySplit(0.0)` advances the residual 
start to `lastAttempted + 1ns` (or leaves `from` unchanged if nothing was 
claimed), while initial startup begins at `createdAt(initialPartition) - 1ns`.
     - Intentionally preserves querying without a `State = 'CREATED'` filter so 
retried detector bundles continue to emit partitions whose Spanner state 
transition already committed in a failed bundle attempt.
   
   ## Testing
   
   - Added unit tests in `PartitionMetadataDaoTest` covering 
`getAllPartitionsCreatedAfter` and `countPartitionsCreatedAfter` for both 
GoogleSQL and PostgreSQL dialects.
   - Updated mock SQL matchers in `SpannerChangeStreamErrorTest`.
   - Verified `:sdks:java:io:google-cloud-platform:test --tests 
"org.apache.beam.sdk.io.gcp.spanner.changestreams.*"`, `spotlessApply`, 
`checkstyleMain`, and `checkstyleTest`.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   
    - [x] Mention the appropriate issue in your description (for example: 
`fixes #123`), if applicable. This will automatically add a link to the pull 
request in the issue. If you would like the issue to automatically close on 
merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more 
tips on [how to make review process 
smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
   
   To check the build health, please visit 
[https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   
------------------------------------------------------------------------------------------------
   [![Build python source distribution and 
wheels](https://github.com/apache/beam/actions/workflows/build_wheels.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions/workflows/build_wheels.yml?query=branch%3Amaster)
   [![Python 
tests](https://github.com/apache/beam/actions/workflows/python_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions/workflows/python_tests.yml?query=branch%3Amaster)
   [![Java 
tests](https://github.com/apache/beam/actions/workflows/java_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions/workflows/java_tests.yml?query=branch%3Amaster)
   [![Go 
tests](https://github.com/apache/beam/actions/workflows/go_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions/workflows/go_tests.yml?query=branch%3Amaster)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more 
information about GitHub Actions CI or the [workflows 
README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) 
to see a list of phrases to trigger workflows.
   


-- 
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