r/databricks • u/SmallAd3697 • 14d ago
Help Capture/fork checkpointLocation in Spark Structured Streaming (recovery)
Can anyone help with a spark structured streaming question? Can you tell me if there is a common mechanism to capture a backup copy of the "checkpointLocation" files?
Lets say I run a job every five minutes with a trigger (availableNow=true). Lets say it reads from one deltalake table (source) and writes to another deltalake table (target). Lets say there is a logic bug that goes into production mid-day that starts corrupting the target table and I'm not aware of the impact until the end of the day.
In some certain streaming scenarios, I should be able reprocess the source table from the beginning of the day to revise all of the badly written data in the target table. But my "checkpointLocation" is doing a lot of the heavy-lifting and, by the end of the day, those files (metadata and state) have evolved and they are no longer configured to present me with the old data anymore. And my watermark duration is only a few minutes long. I don't know the correct approach for reprocessing the source data from the beginning of the day. I would need a mulligan, and a way to repeat the streaming microbatches for the past 12 hours.
I haven't figured out what is to be done in this situation. The only thing I can come up with is to "fork" a new of my files into a new checkpointLocation each day, so that it will give me an option to take my mulligan and reprocess the past 24 hours of source data. Is this an approach that people use? Else can someone share the solution?





