HDFS-16622. addRDBI in IncrementalBlockReportManager may remove the block with bigger GS

This commit is contained in:
zengqiang.xu 2022-06-05 22:50:47 +08:00
parent 25591ef51b
commit 91f7ff3a99
1 changed files with 10 additions and 2 deletions

View File

@ -251,12 +251,20 @@ class IncrementalBlockReportManager {
DatanodeStorage storage) {
// Make sure another entry for the same block is first removed.
// There may only be one such entry.
ReceivedDeletedBlockInfo removedInfo = null;
for (PerStorageIBR perStorage : pendingIBRs.values()) {
if (perStorage.remove(rdbi.getBlock()) != null) {
removedInfo = perStorage.remove(rdbi.getBlock());
if (removedInfo != null) {
break;
}
}
getPerStorageIBR(storage).put(rdbi);
if (removedInfo != null &&
removedInfo.getBlock().getGenerationStamp()
> rdbi.getBlock().getGenerationStamp()) {
getPerStorageIBR(storage).put(removedInfo);
} else {
getPerStorageIBR(storage).put(rdbi);
}
}
synchronized void notifyNamenodeBlock(ReceivedDeletedBlockInfo rdbi,