private boolean deleteFiles() { return replicaToDelete.deleteBlockData() && (replicaToDelete.deleteMetadata() || !replicaToDelete.metadataExists()); }
@Override // FsDatasetSpi public LengthInputStream getMetaDataInputStream(ExtendedBlock b) throws IOException { ReplicaInfo info = getBlockReplica(b); if (info == null || !info.metadataExists()) { return null; } return info.getMetadataInputStream(0); }
/** Check the files of a replica. */ static void checkReplicaFiles(final ReplicaInfo r) throws IOException { //check replica's data exists if (!r.blockDataExists()) { throw new FileNotFoundException("Block data not found, r=" + r); } if (r.getBytesOnDisk() != r.getBlockDataLength()) { throw new IOException("Block length mismatch, len=" + r.getBlockDataLength() + " but r=" + r); } //check replica's meta file if (!r.metadataExists()) { throw new IOException(r.getMetadataURI() + " does not exist, r=" + r); } if (r.getMetadataLength() == 0) { throw new IOException("Metafile is empty, r=" + r); } }
/** * Cleanup the replicaInfo object passed. * * @param bpid - block pool id * @param replicaInfo - ReplicaInfo */ private void cleanupReplica(String bpid, ReplicaInfo replicaInfo) { if (replicaInfo.deleteBlockData() || !replicaInfo.blockDataExists()) { FsVolumeImpl volume = (FsVolumeImpl) replicaInfo.getVolume(); volume.onBlockFileDeletion(bpid, replicaInfo.getBytesOnDisk()); if (replicaInfo.deleteMetadata() || !replicaInfo.metadataExists()) { volume.onMetaFileDeletion(bpid, replicaInfo.getMetadataLength()); } } }
if (memBlockInfo.getBlockURI().compareTo(diskFile.toURI()) != 0) { if (diskMetaFileExists) { if (memBlockInfo.metadataExists()) {