hudi icon indicating copy to clipboard operation
hudi copied to clipboard

[SUPPORT] fail on data loss semantics for Deltastreamer Kafka sources

Open qjqqyy opened this issue 4 years ago • 4 comments

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:

  1. Run deltastreamer with Json/AvroKafkaSource, provide a checkpoint that is out-of-bounds in Kafka
  2. 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
  3. there is no way to make it fail-fast (compared to failOnDataLoss=true for 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 avatar Apr 22 '22 20:04 qjqqyy

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

yihua avatar Apr 26 '22 22:04 yihua

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

qjqqyy avatar Apr 29 '22 21:04 qjqqyy

Sg. Once you open a Jira ticket, we can track the progress there and close this issue.

yihua avatar Apr 29 '22 21:04 yihua

tracked by https://issues.apache.org/jira/browse/HUDI-4006

qjqqyy avatar Apr 30 '22 18:04 qjqqyy