qiuyanjun888 opened a new pull request, #282:
URL: https://github.com/apache/flink-connector-kafka/pull/282
## What is the purpose of the change
FLINK-39193 reports that `SpecifiedOffsetsInitializer` can fail when the
caller passes a non-empty but incomplete specific-offset map.
Before this change, partitions missing from the specific-offset map were
resolved by looking up committed offsets first. That can unexpectedly require
committed-offset lookup even though the caller only configured specific offsets
plus a reset strategy.
This PR changes missing partitions to use the configured
`OffsetResetStrategy` directly:
- specified partitions keep their configured offsets
- missing partitions use `EARLIEST` / `LATEST` according to the reset
strategy
- `NONE` still fails when no offset can be found
This supersedes the previously closed PR #272.
## Brief change log
- Update `SpecifiedOffsetsInitializer` to route missing partitions directly
to the reset strategy instead of `committedOffsets`.
- Update Java docs for `OffsetsInitializer.offsets(...)` to describe
missing-partition behavior.
- Update the existing initializer test expectation.
- Add a focused unit regression test that fails if `committedOffsets` is
called for an incomplete specific-offset map.
## Verifying this change
- RED on `upstream/main` with only the new regression test:
- `mvn -pl flink-connector-kafka
-Dtest=SpecifiedOffsetsInitializerTest#incompleteSpecificOffsetsUsesResetStrategyWithoutCommittedOffsetLookup
-DfailIfNoTests=false test`
- failed as expected with `AssertionError: Committed offsets should not be
used for incomplete specific offsets`
- GREEN after the fix:
- `mvn -pl flink-connector-kafka
-Dtest=SpecifiedOffsetsInitializerTest#incompleteSpecificOffsetsUsesResetStrategyWithoutCommittedOffsetLookup
-DfailIfNoTests=false test`
- `Tests run: 1, Failures: 0, Errors: 0, Skipped: 0`
- Local note: `OffsetsInitializerTest#testSpecificOffsetsInitializer` is
Docker/Testcontainers-backed and could not be completed locally because this
environment has no running Docker daemon (`Could not find a valid Docker
environment`).
--
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]