After a Compute Engine worker node writes files into a gcsfuse mounted local directory and closes them, I want it to synchronously flush the data through to GCS before it notifies other worker nodes that all the files are ready. This is to ensure synchronization between workers.
Q. How to ask gcsfuse to write-through to GCS, then wait for that to complete?
Ideas:
- Run the Linux
sync
command? - Unmount the directory then wait for that
fusermount
command to return? (Besides the write-through time, would it take more than a second or two to unmount then remount for the next worker task?) - Make all the programs in this task call
fsync()
on all their output files? That'd be challenging. - Write an additional file, then
flush()
andfsync()
that one?