qiuyanjun888 opened a new pull request, #272:
URL: https://github.com/apache/flink-connector-kafka/pull/272
## Summary
- Fix `SpecifiedOffsetsInitializer` so partitions missing from a non-empty
specific-offset map use the configured `OffsetResetStrategy` instead of
querying committed offsets first.
- Clarify the Java `OffsetsInitializer.offsets(...)` documentation for
missing specified offsets.
- Add a focused regression test proving incomplete specific-offset maps do
not call `committedOffsets(...)`.
## Root Cause
`SpecifiedOffsetsInitializer#getPartitionOffsets` treated partitions not
present in the caller-provided specific-offset map as candidates for
committed-offset lookup before falling back to the reset strategy. For callers
that provide a specific-offset map without relying on committed offsets, this
can fail when the Kafka source cannot query committed offsets (for example
because the consumer group/commit path is unavailable), even though the
configured reset strategy should be enough to initialize the missing partitions.
## Changes
- For unspecified partitions, apply `EARLIEST`, `LATEST`, or `NONE` directly
via the configured reset strategy.
- Update the existing offset initializer expectation from committed-offset
fallback to reset-strategy fallback.
- Add
`SpecifiedOffsetsInitializerTest#incompleteSpecificOffsetsUsesResetStrategyWithoutCommittedOffsetLookup`.
## Validation
- `mvn -pl flink-connector-kafka
-Dtest=SpecifiedOffsetsInitializerTest#incompleteSpecificOffsetsUsesResetStrategyWithoutCommittedOffsetLookup
-DfailIfNoTests=false test`
- Verified RED before the fix: failed because `committedOffsets(...)` was
called.
- Verified GREEN after the fix: `Tests run: 1, Failures: 0, Errors: 0,
Skipped: 0`.
- `mvn -pl flink-connector-kafka -DskipTests test`
- `You have 0 Checkstyle violations`.
- `Spotless.Java ... 0 needs changes`.
- `BUILD SUCCESS`.
Note: I did not claim full module tests locally. A Docker-backed existing
`OffsetsInitializerTest` baseline attempt was blocked by a missing valid Docker
environment, so I kept validation to the focused unit regression plus module
compile/checkstyle/spotless.
## AI Assistance
This pull request was prepared with AI assistance under human-directed scope
for FLINK-39193.
--
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]