HDFS-16922. The logic of IncrementalBlockReportManager#addRDBI method may cause missing blocks when cluster is busy.

This commit is contained in:
admin 2023-02-15 10:06:05 +08:00
parent d56977e909
commit 15d7f88d86
1 changed files with 7 additions and 1 deletions

View File

@ -117,6 +117,10 @@ class IncrementalBlockReportManager {
}
return count;
}
ReceivedDeletedBlockInfo get(Block block) {
return blocks.getOrDefault(block, null);
}
}
/**
@ -252,7 +256,9 @@ class IncrementalBlockReportManager {
// Make sure another entry for the same block is first removed.
// There may only be one such entry.
for (PerStorageIBR perStorage : pendingIBRs.values()) {
if (perStorage.remove(rdbi.getBlock()) != null) {
ReceivedDeletedBlockInfo oldRdbi = perStorage.get(rdbi.getBlock());
if (oldRdbi != null && oldRdbi.getBlock().getGenerationStamp() < rdbi.getBlock().getGenerationStamp()
&& perStorage.remove(oldRdbi.getBlock()) != null) {
break;
}
}