Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Problem
-
2.0.3-alpha, 3.0.0-alpha1
-
None
-
None
Description
If persists blocks enabled/in HA, evenry getAdditionalBlock will persist the blocks.
So, if user calls Hflush, then client can simply ensure data flushed to DNs and need not worry about fsync.
Since we can not depend upon client side configuration about persistBlocks, we can just make a fsync call to NN and check whether persistBlocks enabled. If it is enabled, then simply return as it would have already persisted. So, that below peice of code execution can be avoided for every blocks and hflush calls
from fsync:
writeLock(); try { checkOperation(OperationCategory.WRITE); if (isInSafeMode()) { throw new SafeModeException("Cannot fsync file " + src, safeMode); } INodeFileUnderConstruction pendingFile = checkLease(src, clientName); dir.persistBlocks(src, pendingFile); } finally { writeUnlock(); } getEditLog().logSync();