Interview practice question
Duplicates in a streaming sink after restart
Data Engineering · Spark · Experienced
After a streaming job restarted, you see duplicate rows in your external database sink. Why, and how do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- After failure, Spark replays the last micro-batch from the checkpoint.
- A non-transactional sink can receive the same batch twice.
- Make writes idempotent with upserts on keys.
- Track the last committed batchId in the sink.
- Delta and Kafka sinks have built-in guarantees.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.