haiyang1987 opened a new pull request, #5359:
URL: https://github.com/apache/hadoop/pull/5359

   
   ### Description of PR
   
   At present, after our cluster backport patch 
[HDFS-15882](https://issues.apache.org/jira/browse/HDFS-15882),
   when set shouldSyncWritesAndSkipFsync to false, there will be flush 
performance degradation caused by JN.
   
   Root Cause:
   when setting shouldSyncWritesAndSkipFsync to false, the mode of init 
RandomAccessFile will be `rws`.
   even if fc.force(false) is executed when flushAndSync is executed 
(hopefully, only requires updates to the file's content to be written to 
storage and the metadata is not update),
   but since the mode of RandomAccessFile is `rws`, It will requires updates to 
both the file's content and its metadata to be written,
   there will be flush performance degradation caused by JN.
   
   
   ### For code changes:
   
   Need to update RandomAccessFile's mode from `rws` to `rwd`:
   
   rwd: Open for reading and writing, as with "rw", and also require that every 
update to the file's content be written synchronously to the underlying storage 
device.
   
   if (shouldSyncWritesAndSkipFsync) {
   rp = new RandomAccessFile(name, "rwd");
   } else {
   rp = new RandomAccessFile(name, "rw");
   }
   In this way, when flushAndSync is executed,
   if shouldSyncWritesAndSkipFsync is false and the mode of RandomAccessFile is 
'rw', it will call fc.force(false) to execute,
   otherwise should use `rwd` to perform the operation.
   
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to