|
@@ -965,6 +965,11 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
newReplicaInfo.setNumBytes(blockFiles[1].length());
|
|
newReplicaInfo.setNumBytes(blockFiles[1].length());
|
|
// Finalize the copied files
|
|
// Finalize the copied files
|
|
newReplicaInfo = finalizeReplica(block.getBlockPoolId(), newReplicaInfo);
|
|
newReplicaInfo = finalizeReplica(block.getBlockPoolId(), newReplicaInfo);
|
|
|
|
+ synchronized (this) {
|
|
|
|
+ // Increment numBlocks here as this block moved without knowing to BPS
|
|
|
|
+ FsVolumeImpl volume = (FsVolumeImpl) newReplicaInfo.getVolume();
|
|
|
|
+ volume.getBlockPoolSlice(block.getBlockPoolId()).incrNumBlocks();
|
|
|
|
+ }
|
|
|
|
|
|
removeOldReplica(replicaInfo, newReplicaInfo, oldBlockFile, oldMetaFile,
|
|
removeOldReplica(replicaInfo, newReplicaInfo, oldBlockFile, oldMetaFile,
|
|
oldBlockFile.length(), oldMetaFile.length(), block.getBlockPoolId());
|
|
oldBlockFile.length(), oldMetaFile.length(), block.getBlockPoolId());
|
|
@@ -2599,6 +2604,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
final long reservedSpace; // size of space reserved for non-HDFS
|
|
final long reservedSpace; // size of space reserved for non-HDFS
|
|
final long reservedSpaceForReplicas; // size of space reserved RBW or
|
|
final long reservedSpaceForReplicas; // size of space reserved RBW or
|
|
// re-replication
|
|
// re-replication
|
|
|
|
+ final long numBlocks;
|
|
|
|
|
|
VolumeInfo(FsVolumeImpl v, long usedSpace, long freeSpace) {
|
|
VolumeInfo(FsVolumeImpl v, long usedSpace, long freeSpace) {
|
|
this.directory = v.toString();
|
|
this.directory = v.toString();
|
|
@@ -2606,6 +2612,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
this.freeSpace = freeSpace;
|
|
this.freeSpace = freeSpace;
|
|
this.reservedSpace = v.getReserved();
|
|
this.reservedSpace = v.getReserved();
|
|
this.reservedSpaceForReplicas = v.getReservedForReplicas();
|
|
this.reservedSpaceForReplicas = v.getReservedForReplicas();
|
|
|
|
+ this.numBlocks = v.getNumBlocks();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2640,6 +2647,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
innerInfo.put("freeSpace", v.freeSpace);
|
|
innerInfo.put("freeSpace", v.freeSpace);
|
|
innerInfo.put("reservedSpace", v.reservedSpace);
|
|
innerInfo.put("reservedSpace", v.reservedSpace);
|
|
innerInfo.put("reservedSpaceForReplicas", v.reservedSpaceForReplicas);
|
|
innerInfo.put("reservedSpaceForReplicas", v.reservedSpaceForReplicas);
|
|
|
|
+ innerInfo.put("numBlocks", v.numBlocks);
|
|
info.put(v.directory, innerInfo);
|
|
info.put(v.directory, innerInfo);
|
|
}
|
|
}
|
|
return info;
|
|
return info;
|
|
@@ -2728,8 +2736,8 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|
synchronized (FsDatasetImpl.this) {
|
|
synchronized (FsDatasetImpl.this) {
|
|
ramDiskReplicaTracker.recordEndLazyPersist(bpId, blockId, savedFiles);
|
|
ramDiskReplicaTracker.recordEndLazyPersist(bpId, blockId, savedFiles);
|
|
|
|
|
|
- targetVolume.incDfsUsed(bpId,
|
|
|
|
- savedFiles[0].length() + savedFiles[1].length());
|
|
|
|
|
|
+ targetVolume.incDfsUsedAndNumBlocks(bpId, savedFiles[0].length()
|
|
|
|
+ + savedFiles[1].length());
|
|
|
|
|
|
// Update metrics (ignore the metadata file size)
|
|
// Update metrics (ignore the metadata file size)
|
|
datanode.getMetrics().incrRamDiskBlocksLazyPersisted();
|
|
datanode.getMetrics().incrRamDiskBlocksLazyPersisted();
|