HDFS-9661. Deadlock in DN.FsDatasetImpl between moveBlockAcrossStorage and createRbw (Contributed by ade)
(cherry picked from commit 1425578690
)
This commit is contained in:
parent
15713f947c
commit
3d38c1ef3a
|
@ -1712,6 +1712,9 @@ Release 2.7.3 - UNRELEASED
|
|||
HDFS-9648. TestStartup.testImageChecksum is broken by HDFS-9569's message
|
||||
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
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -939,8 +939,11 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
+ replicaInfo.getVolume().getStorageType());
|
||||
}
|
||||
|
||||
try (FsVolumeReference volumeRef = volumes.getNextVolume(
|
||||
targetStorageType, block.getNumBytes())) {
|
||||
FsVolumeReference volumeRef = null;
|
||||
synchronized (this) {
|
||||
volumeRef = volumes.getNextVolume(targetStorageType, block.getNumBytes());
|
||||
}
|
||||
try {
|
||||
File oldBlockFile = replicaInfo.getBlockFile();
|
||||
File oldMetaFile = replicaInfo.getMetaFile();
|
||||
FsVolumeImpl targetVolume = (FsVolumeImpl) volumeRef.getVolume();
|
||||
|
@ -959,6 +962,10 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
|
||||
removeOldReplica(replicaInfo, newReplicaInfo, oldBlockFile, oldMetaFile,
|
||||
oldBlockFile.length(), oldMetaFile.length(), block.getBlockPoolId());
|
||||
} finally {
|
||||
if (volumeRef != null) {
|
||||
volumeRef.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Replace the old block if any to reschedule the scanning.
|
||||
|
|
Loading…
Reference in New Issue