Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is spark overwrite save mode atomic?

Tags:

apache-spark

Using spark overwrite mode to write dataset deletes old files in the partitions and write the new data. Is this process atomic ? If the job fails while overwriting the data, will spark revert the old files present in the partitions ?

like image 669
rk.the1 Avatar asked Oct 28 '25 05:10

rk.the1


1 Answers

According to this post in databricks is not (emphasys mine):

It is sometimes useful to atomically overwrite a set of existing files. Today, Spark implements overwrite by first deleting the dataset, then executing the job producing the new data. This interrupts all current readers and is not fault-tolerant. With transactional commit, it is possible to “logically delete” files atomically by marking them as deleted at commit time

But they also offer an alternative to achieve atomic overwrite

like image 78
SCouto Avatar answered Oct 30 '25 09:10

SCouto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!