@Override // Object public boolean equals(Object o) { return super.equals(o); }
@Override public OutputStream createRestartMetaStream() throws IOException { File blockFile = getBlockFile(); File restartMeta = new File(blockFile.getParent() + File.pathSeparator + "." + blockFile.getName() + ".restart"); if (!getFileIoProvider().deleteWithExistsCheck(getVolume(), restartMeta)) { DataNode.LOG.warn("Failed to delete restart meta file: " + restartMeta.getPath()); } return getFileIoProvider().getFileOutputStream(getVolume(), restartMeta); }
/** * Copy constructor. * @param from where to copy from */ public LocalReplicaInPipeline(LocalReplicaInPipeline from) { super(from); this.bytesAcked = from.getBytesAcked(); this.bytesOnDisk = from.getBytesOnDisk(); this.writer.set(from.writer.get()); this.bytesReserved = from.bytesReserved; this.originalBytesReserved = from.originalBytesReserved; }
final File blockFile = getBlockFile(); final File metaFile = getMetaFile(); if (DataNode.LOG.isDebugEnabled()) { DataNode.LOG.debug("writeTo blockfile is " + blockFile + getFileIoProvider().getRandomAccessFile(getVolume(), metaFile, "rw"); final FileIoProvider fileIoProvider = getFileIoProvider(); FileOutputStream blockOut = null; FileOutputStream crcOut = null; try { blockOut = fileIoProvider.getFileOutputStream( getVolume(), new RandomAccessFile(blockFile, "rw").getFD()); crcOut = fileIoProvider.getFileOutputStream(getVolume(), metaRAF.getFD()); if (!isCreate) { blockOut.getChannel().position(blockDiskSize); getVolume(), fileIoProvider); } catch (IOException e) { IOUtils.closeStream(blockOut);
final File oldBlockFile = oldReplica.getBlockFile(); final File oldmeta = oldReplica.getMetaFile(); final File newmeta = getMetaFile(); final FileIoProvider fileIoProvider = getFileIoProvider(); fileIoProvider.rename(getVolume(), oldmeta, newmeta); } catch (IOException e) { throw new IOException("Block " + oldReplicaInfo + " reopen failed. " + fileIoProvider.rename(getVolume(), oldBlockFile, newBlkFile); } catch (IOException e) { try { fileIoProvider.rename(getVolume(), newmeta, oldmeta); } catch (IOException ex) { LOG.warn("Cannot move meta file " + newmeta +
@Override public ReplicaInfo getOriginalReplica() { throw new UnsupportedOperationException("Replica of type " + getState() + " does not support getOriginalReplica"); }
@Override // ReplicaInPipeline public void setBytesAcked(long bytesAcked) { long newBytesAcked = bytesAcked - this.bytesAcked; this.bytesAcked = bytesAcked; // Once bytes are ACK'ed we can release equivalent space from the // volume's reservedForRbw count. We could have released it as soon // as the write-to-disk completed but that would be inefficient. getVolume().releaseReservedSpace(newBytesAcked); bytesReserved -= newBytesAcked; }
@Override // Object public int hashCode() { return super.hashCode(); } }
@Override // ReplicaInPipeline public synchronized ChunkChecksum getLastChecksumAndDataLen() { return new ChunkChecksum(getBytesOnDisk(), lastChecksum); }
private LocalReplicaInPipeline buildTemporaryReplica() throws IllegalArgumentException { if (null != fromReplica && fromReplica.getState() == ReplicaState.TEMPORARY) { return new LocalReplicaInPipeline((LocalReplicaInPipeline) fromReplica); } else if (null != fromReplica) { throw new IllegalArgumentException("Incompatible fromReplica " + "state: " + fromReplica.getState()); } else { if (null != block) { if (null == writer) { throw new IllegalArgumentException("A valid writer is " + "required for constructing a Replica from block " + block.getBlockId()); } return new LocalReplicaInPipeline(block, volume, directoryUsed, writer); } else { if (length != -1) { return new LocalReplicaInPipeline(blockId, length, genStamp, volume, directoryUsed, writer, bytesToReserve); } else { return new LocalReplicaInPipeline(blockId, genStamp, volume, directoryUsed, bytesToReserve); } } } }
@Override public void setRecoveryID(long recoveryId) { throw new UnsupportedOperationException("Replica of type " + getState() + " does not support setRecoveryID"); }
@Override public long getRecoveryID() { throw new UnsupportedOperationException("Replica of type " + getState() + " does not support getRecoveryID"); }
@Override public ReplicaRecoveryInfo createInfo(){ throw new UnsupportedOperationException("Replica of type " + getState() + " does not support createInfo"); }