Updating JIRA name to match the bug. There are several issues at hand:
1) commitBlockSynchronization was adding the nodes to the blocks map, even if the block is the last block in an in-progress file. This happens if there is a pipeline failure, for example.
2) addStoredBlock was adding the node to the blocks map even if the block is an earlier-GS replica of the last block in an in-progress file. This happens if one of the DNs restarts and sends its earlier-GS RWR block to the NN while the writer is still writing to the same block.
Both of these cases cause "completeFile" to be able to finalize the INodeFileUnderConstruction before the correct length of the last block has been reported, which results in temporarily visible truncation of the appended data.