MartijnVisser commented on code in PR #360:
URL:
https://github.com/apache/flink-connector-kafka/pull/360#discussion_r4744165713
##########
docs/content/docs/connectors/datastream/kafka.md:
##########
@@ -244,6 +244,12 @@ Please note that the following keys will be set by the
builder:
for the starting offsets unless it is explicitly configured. The initializer
selects the initial
position, while an explicitly configured ```auto.offset.reset``` controls
what happens if an
initialized position later becomes unavailable.
+ ```OffsetsInitializer.earliest()```, ```latest()``` and
```timestamp(long)``` use ```EARLIEST```:
+ if the source falls behind topic retention, or is restored from a checkpoint
whose offsets were
+ already deleted, it continues from the earliest offset still in the log
instead of skipping the
+ remaining records. If the topic was truncated or recreated, a restored
position can also be
+ above the end of the log; the source then rereads every record still in the
log. Set
Review Comment:
Also worth naming a savepoint restored against a mirror after a failover: it
rereads records from before the starting offsets, which are late for event-time
windows. Same for the Table and zh pages.
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/initializer/OffsetsInitializer.java:
##########
@@ -62,14 +62,31 @@ Map<TopicPartition, Long> getPartitionOffsets(
/**
* Get the auto offset reset strategy in case the initialized offsets
falls out of the range.
*
- * <p>The OffsetStrategy is only used when the offset initializer is used
to initialize the
- * starting offsets and the starting offsets is out of range.
+ * <p>The strategy is only used when the offset initializer is used to
initialize the starting
+ * offsets. It applies whenever the position of a split is out of range: a
starting offset that
+ * is not in the log, or the position of a running or restored split that
later left the log,
+ * either because it fell behind retention or because it is above the log
end after the topic
+ * was truncated or recreated. An explicitly configured {@code
auto.offset.reset} takes
+ * precedence.
*
* @return An {@link OffsetResetStrategy} to use if the initialized
offsets are out of the
* range.
*/
OffsetResetStrategy getAutoOffsetResetStrategy();
+ /**
+ * Returns whether {@link #getPartitionOffsets} resolves concrete offsets,
rather than markers
+ * such as earliest or committed that the reader resolves. If so, the
{@link
+ * #getAutoOffsetResetStrategy() reset strategy} never decides where a
split starts, and an
+ * explicitly configured {@code auto.offset.reset} that differs from it is
an independent choice
+ * rather than a conflict.
+ *
+ * @return true if the returned offsets are concrete offsets.
+ */
+ default boolean resolvesConcreteOffsets() {
Review Comment:
This becomes `@PublicEvolving` through the interface but only drives a log
line. Might make sense to mark it `@Internal`, like the methods on
`DynamicKafkaSource`.
--
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]