reidkaufmann commented on PR #890:
URL: 
https://github.com/apache/arrow-rs-object-store/pull/890#issuecomment-6751683029

   > I think this fsync design is overly complicated. There are only a handful 
cases where you need to fsync a directory:
   > 
   >     * when it's created
   > 
   >     * when any of it's entries changes:
   >       
   >       * sub-dir created
   >       * sub-dir removed
   >       * file created
   >       * file renamed (source)
   >       * file renamed (target)
   >       * file removed
   > 
   > 
   > I don't see why we would need a global state set for this.
   
   I agree with the list of operations that require parent fsync. Why a global 
structure for coordination? That's because of interactions between multiple 
writes (from the issue):
   
   > With LocalFileSystem::with_fsync(true), 
[create_parent_dirs](https://github.com/apache/arrow-rs-object-store/blob/279572ea60f3a7a6e5237e066a6f4a35eee611e0/src/local.rs#L905-L947)
 records the deepest existing ancestor, calls create_dir_all and fsyncs from 
the new parent up to that ancestor. Three interleaved calls can return success 
while a directory entry on the path to the written file is not durable, so a 
power loss can remove the directory with the file which is expected to be 
durable in this narrow case:
   >
   > - A write into a directory another call is still creating finds it 
existing, fsyncs only that directory 
([fsync_parent_dir](https://github.com/apache/arrow-rs-object-store/blob/279572ea60f3a7a6e5237e066a6f4a35eee611e0/src/local.rs#L1037-L1042))
 and returns before the creator has fsynced the ancestor directory.
   > - With with_automatic_cleanup(true), a concurrent delete can remove the 
ancestor found existing between the exists() check and create_dir_all; 
create_dir_all recreates it and its new entry in the directory above is never 
fsynced.
   > - When a creator's directory fsync fails after create_dir_all, the 
directories exist but nothing records that they are not durable; a later write 
into them fsyncs only its own parent and returns success.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to