HDFS-9661. Deadlock in DN.FsDatasetImpl between moveBlockAcrossStorage and createRbw (Contributed by ade)

This commit is contained in:
Vinayakumar B 2016-01-20 21:04:21 +05:30
parent 57d0a94305
commit 1425578690
2 changed files with 12 additions and 2 deletions

View File

@ -2646,6 +2646,9 @@ Release 2.7.3 - UNRELEASED
HDFS-9648. TestStartup.testImageChecksum is broken by HDFS-9569's message HDFS-9648. TestStartup.testImageChecksum is broken by HDFS-9569's message
change. (Wei-Chiu Chuang via Yongjun Zhang) change. (Wei-Chiu Chuang via Yongjun Zhang)
HDFS-9661. Deadlock in DN.FsDatasetImpl between moveBlockAcrossStorage and
createRbw (ade via vinayakumarb)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -936,8 +936,11 @@ public ReplicaInfo moveBlockAcrossStorage(ExtendedBlock block,
+ replicaInfo.getVolume().getStorageType()); + replicaInfo.getVolume().getStorageType());
} }
try (FsVolumeReference volumeRef = volumes.getNextVolume( FsVolumeReference volumeRef = null;
targetStorageType, block.getNumBytes())) { synchronized (this) {
volumeRef = volumes.getNextVolume(targetStorageType, block.getNumBytes());
}
try {
File oldBlockFile = replicaInfo.getBlockFile(); File oldBlockFile = replicaInfo.getBlockFile();
File oldMetaFile = replicaInfo.getMetaFile(); File oldMetaFile = replicaInfo.getMetaFile();
FsVolumeImpl targetVolume = (FsVolumeImpl) volumeRef.getVolume(); FsVolumeImpl targetVolume = (FsVolumeImpl) volumeRef.getVolume();
@ -956,6 +959,10 @@ public ReplicaInfo moveBlockAcrossStorage(ExtendedBlock block,
removeOldReplica(replicaInfo, newReplicaInfo, oldBlockFile, oldMetaFile, removeOldReplica(replicaInfo, newReplicaInfo, oldBlockFile, oldMetaFile,
oldBlockFile.length(), oldMetaFile.length(), block.getBlockPoolId()); oldBlockFile.length(), oldMetaFile.length(), block.getBlockPoolId());
} finally {
if (volumeRef != null) {
volumeRef.close();
}
} }
// Replace the old block if any to reschedule the scanning. // Replace the old block if any to reschedule the scanning.