You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/11/28 08:40:05 UTC

[GitHub] gianm commented on issue #6665: Race between file reader and writer in FileSessionCredentialsProvider

gianm commented on issue #6665: Race between file reader and writer in FileSessionCredentialsProvider
URL: https://github.com/apache/incubator-druid/issues/6665#issuecomment-442364514
 
 
   Are you talking about Druid possibly reading partially-written content from a file? If so, then in general, the right way to update a file on a POSIX system that might have concurrent readers is to write a tmp file on the same filesystem, and then rename the new file over the old one. If you need the file's data to be durable after a system crash, you should fsync the file too, and the directory entry for the parent directory. The file updater external to Druid should be doing all of that, and if it does, then Druid can get a consistent read of the file.
   
   Mandatory locking is supported in Linux but frowned upon (https://lwn.net/Articles/667210/).
   
   See FileUtils.writeAtomically for an example of code in Druid that gets it (mostly) right. Although it's not fsyncing the containing directory entry, and it should be. That should be fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org