@Override // ReplicaInPipeline public synchronized ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(getBytesOnDisk(), lastChecksum); }
private ChunkChecksum getPartialChunkChecksumForFinalized( FinalizedReplica finalized) throws IOException { // There are a number of places in the code base where a finalized replica // object is created. If last partial checksum is loaded whenever a // finalized replica is created, it would increase latency in DataNode // initialization. Therefore, the last partial chunk checksum is loaded // lazily. // Load last checksum in case the replica is being written concurrently final long replicaVisibleLength = replica.getVisibleLength(); if (replicaVisibleLength % CHUNK_SIZE != 0 && finalized.getLastPartialChunkChecksum() == null) { // the finalized replica does not have precomputed last partial // chunk checksum. Recompute now. try { finalized.loadLastPartialChunkChecksum(); return new ChunkChecksum(finalized.getVisibleLength(), finalized.getLastPartialChunkChecksum()); } catch (FileNotFoundException e) { // meta file is lost. Continue anyway to preserve existing behavior. DataNode.LOG.warn( "meta file " + finalized.getMetaFile() + " is missing!"); return null; } } else { // If the checksum is null, BlockSender will use on-disk checksum. return new ChunkChecksum(finalized.getVisibleLength(), finalized.getLastPartialChunkChecksum()); } }
@Override public ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(oStream.getLength(), null); } }
@Override // ReplicaInPipelineInterface public synchronized ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(getBytesOnDisk(), lastChecksum); }
@Override public ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(oStream.getLength(), null); }
@Override // ReplicaInPipelineInterface public synchronized ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(getBytesOnDisk(), lastChecksum); }
@Override public ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(0, null); }
@Override public ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(oStream.getLength(), null); }
/** * gets the last chunk checksum and the length of the block corresponding * to that checksum. * Note, need to be called with the FsDataset lock acquired. May improve to * lock only the FsVolume in the future. * @throws IOException */ public ChunkChecksum getLastChecksumAndDataLen() throws IOException { ChunkChecksum chunkChecksum = null; try { byte[] lastChecksum = getVolume().loadLastPartialChunkChecksum( getBlockFile(), getMetaFile()); if (lastChecksum != null) { chunkChecksum = new ChunkChecksum(getVisibleLength(), lastChecksum); } } catch (FileNotFoundException e) { // meta file is lost. Try to continue anyway. DataNode.LOG.warn("meta file " + getMetaFile() + " is missing!"); } catch (IOException ioe) { DataNode.LOG.warn("Unable to read checksum from meta file " + getMetaFile(), ioe); } return chunkChecksum; } }
/** * gets the last chunk checksum and the length of the block corresponding * to that checksum. * Note, need to be called with the FsDataset lock acquired. May improve to * lock only the FsVolume in the future. * @throws IOException */ public ChunkChecksum getLastChecksumAndDataLen() throws IOException { ChunkChecksum chunkChecksum = null; try { byte[] lastChecksum = getVolume().loadLastPartialChunkChecksum( getBlockFile(), getMetaFile()); if (lastChecksum != null) { chunkChecksum = new ChunkChecksum(getVisibleLength(), lastChecksum); } } catch (FileNotFoundException e) { // meta file is lost. Try to continue anyway. DataNode.LOG.warn("meta file " + getMetaFile() + " is missing!"); } catch (IOException ioe) { DataNode.LOG.warn("Unable to read checksum from meta file " + getMetaFile(), ioe); } return chunkChecksum; } }