|
@@ -1159,7 +1159,8 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
// construct a RBW replica with the new GS
|
|
// construct a RBW replica with the new GS
|
|
File blkfile = replicaInfo.getBlockFile();
|
|
File blkfile = replicaInfo.getBlockFile();
|
|
FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume();
|
|
FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume();
|
|
- if (v.getAvailable() < estimateBlockLen - replicaInfo.getNumBytes()) {
|
|
|
|
|
|
+ long bytesReserved = estimateBlockLen - replicaInfo.getNumBytes();
|
|
|
|
+ if (v.getAvailable() < bytesReserved) {
|
|
throw new DiskOutOfSpaceException("Insufficient space for appending to "
|
|
throw new DiskOutOfSpaceException("Insufficient space for appending to "
|
|
+ replicaInfo);
|
|
+ replicaInfo);
|
|
}
|
|
}
|
|
@@ -1167,7 +1168,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
File oldmeta = replicaInfo.getMetaFile();
|
|
File oldmeta = replicaInfo.getMetaFile();
|
|
ReplicaBeingWritten newReplicaInfo = new ReplicaBeingWritten(
|
|
ReplicaBeingWritten newReplicaInfo = new ReplicaBeingWritten(
|
|
replicaInfo.getBlockId(), replicaInfo.getNumBytes(), newGS,
|
|
replicaInfo.getBlockId(), replicaInfo.getNumBytes(), newGS,
|
|
- v, newBlkFile.getParentFile(), Thread.currentThread(), estimateBlockLen);
|
|
|
|
|
|
+ v, newBlkFile.getParentFile(), Thread.currentThread(), bytesReserved);
|
|
File newmeta = newReplicaInfo.getMetaFile();
|
|
File newmeta = newReplicaInfo.getMetaFile();
|
|
|
|
|
|
// rename meta file to rbw directory
|
|
// rename meta file to rbw directory
|
|
@@ -1203,7 +1204,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
|
|
|
|
// Replace finalized replica by a RBW replica in replicas map
|
|
// Replace finalized replica by a RBW replica in replicas map
|
|
volumeMap.add(bpid, newReplicaInfo);
|
|
volumeMap.add(bpid, newReplicaInfo);
|
|
- v.reserveSpaceForReplica(estimateBlockLen - replicaInfo.getNumBytes());
|
|
|
|
|
|
+ v.reserveSpaceForReplica(bytesReserved);
|
|
return newReplicaInfo;
|
|
return newReplicaInfo;
|
|
}
|
|
}
|
|
|
|
|