/** * Get the full path of this replica's meta file. * @return the full path of this replica's meta file */ @VisibleForTesting public File getMetaFile() { return new File(getDir(), DatanodeUtil.getMetaName(getBlockName(), getGenerationStamp())); }
@Override public ReplicaRecoveryInfo createInfo() { return new ReplicaRecoveryInfo(original.getBlockId(), original.getBytesOnDisk(), original.getGenerationStamp(), original.getState()); } }
@Override public void bumpReplicaGS(long newGS) throws IOException { long oldGS = getGenerationStamp(); final File oldmeta = getMetaFile(); setGenerationStamp(newGS); final File newmeta = getMetaFile(); // rename meta file to new GS if (LOG.isDebugEnabled()) { LOG.debug("Renaming " + oldmeta + " to " + newmeta); } try { // calling renameMeta on the ReplicaInfo doesn't work here getFileIoProvider().rename(getVolume(), oldmeta, newmeta); } catch (IOException e) { setGenerationStamp(oldGS); // restore old GS throw new IOException("Block " + this + " reopen failed. " + " Unable to move meta file " + oldmeta + " to " + newmeta, e); } }