private void copyBlockLocalFinalize ( int dstNamespaceId , Block dstBlock , File dstBlockFile ) throws IOException { boolean inlineChecksum = Block . isInlineChecksumBlockFilename ( dstBlockFile . getName ( ) ) ; long blkSize = 0 ; long fileSize = dstBlockFile . length ( ) ; lock . writeLock ( ) . lock ( ) ; try { DatanodeBlockInfo info = volumeMap . get ( dstNamespaceId , dstBlock ) ; if ( info == null ) { throw new IOException ( "Could not find information for " + dstBlock ) ; } if ( inlineChecksum ) { blkSize = BlockInlineChecksumReader . getBlockSizeFromFileLength ( fileSize , info . getChecksumType ( ) , info . getBytesPerChecksum ( ) ) ; } else { blkSize = fileSize ; } FSVolume dstVol = info . getBlockDataFile ( ) . getVolume ( ) ; // Finalize block on disk. File dest = dstVol . addBlock ( dstNamespaceId , dstBlock , dstBlockFile , info . isInlineChecksum ( ) , info . getChecksumType ( ) , info . getBytesPerChecksum ( ) ) ; volumeMap . add ( dstNamespaceId , dstBlock , new DatanodeBlockInfo ( dstVol , dest , blkSize , true , inlineChecksum , info . getChecksumType ( ) , info . getBytesPerChecksum ( ) , false , 0 ) ) ; volumeMap . removeOngoingCreates ( dstNamespaceId , dstBlock ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } }
Finalize the block in FSDataset .