[SUPPORT] fail on data loss semantics for Deltastreamer Kafka sources
Describe the problem you faced
For streaming ingestion Kafka -> Hudi with deltastreamer, it is sometimes desirable to fail-fast when there is possible data loss (Kafka offsets go out of range), seems like this cannot be done.
To Reproduce
Steps to reproduce the behavior:
- Run deltastreamer with Json/AvroKafkaSource, provide a checkpoint that is out-of-bounds in Kafka
- KafkaOffsetGen will replay data from earliest available offset instead https://github.com/apache/hudi/blob/20781a5fa6cfcb0069855e57a1974db435de37c9/hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/KafkaOffsetGen.java#L301
- there is no way to make it fail-fast (compared to
failOnDataLoss=truefor Spark structured streaming Kafka)
Side note: the way it seeks to earliest is also flaky, the offsets returned by KafkaOffsetGen could have expired by the time the Spark executor starts reading from kafka, causing the stage to fail.
Expected behavior
A way to configure KafkaOffsetGen to fail-fast when the checkpoint offset is out of bounds (maybe allow explicitly setting auto.offset.reset=none and interpret that as fail on data loss).
@qjqqyy Thanks for the Inquiry. I'd like to understand your use case first. By providing a checkpoint that is out-of-bounds in Kafka, do you mean using --checkpoint option to provide the Kafka offset to the Hudi Deltastreamer? Usually, the checkpointing is maintained by Deltastreamer so it is not required, and only for the first run, the checkpoint may be provided. In the later case, the user needs to make sure the checkpoint is valid according to the source.
However, I see that this can be a usability improvement. If you have time, I encourage you to file a Jira ticket, detail the solution, and contribute this improvement to the community by putting up a PR.
To clarify, specifying--checkpoint is just a way to explicitly take the kafka offset OOB code path, it can happen "naturally" when there is a lot of incoming records and the ingestion job is undertuned.
Will open a ticket to track this
Sg. Once you open a Jira ticket, we can track the progress there and close this issue.
tracked by https://issues.apache.org/jira/browse/HUDI-4006