Remove empty queues from the queueByBlockId map (#6772)
This commit is contained in:
parent
399299104c
commit
027b4c3259
@ -112,14 +112,14 @@ void removeQueuedBlock(DatanodeStorageInfo storageInfo, Block block) {
|
|||||||
if (storageInfo == null || block == null) {
|
if (storageInfo == null || block == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
block = new Block(block);
|
Block blk = new Block(block);
|
||||||
Queue<ReportedBlockInfo> queue = null;
|
|
||||||
if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
|
if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
|
||||||
Block blkId = new Block(BlockIdManager.convertToStripedID(block
|
blk = new Block(BlockIdManager.convertToStripedID(block
|
||||||
.getBlockId()));
|
.getBlockId()));
|
||||||
queue = getBlockQueue(blkId);
|
}
|
||||||
} else {
|
Queue<ReportedBlockInfo> queue = queueByBlockId.get(blk);
|
||||||
queue = getBlockQueue(block);
|
if (queue == null) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// We only want the latest non-future reported block to be queued for each
|
// We only want the latest non-future reported block to be queued for each
|
||||||
// DataNode. Otherwise, there can be a race condition that causes an old
|
// DataNode. Otherwise, there can be a race condition that causes an old
|
||||||
@ -130,6 +130,11 @@ void removeQueuedBlock(DatanodeStorageInfo storageInfo, Block block) {
|
|||||||
if (queue.removeIf(rbi -> storageInfo.equals(rbi.storageInfo))) {
|
if (queue.removeIf(rbi -> storageInfo.equals(rbi.storageInfo))) {
|
||||||
count -= (size - queue.size());
|
count -= (size - queue.size());
|
||||||
}
|
}
|
||||||
|
// If the block message queue is now empty, we should remove the block
|
||||||
|
// from the queue.
|
||||||
|
if (queue.isEmpty()) {
|
||||||
|
queueByBlockId.remove(blk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user