sodonnel commented on pull request #3928:
URL: https://github.com/apache/hadoop/pull/3928#issuecomment-1023076178
This is the scan logic:
```
for (DatanodeStorageInfo s : storage) {
namesystem.readLock();
try {
// As the lock is dropped and re-taken between each storage, we need
// to check the storage is still present before processing it, as it
// may have been removed.
if (dn.getStorageInfo(s.getStorageID()) == null) {
continue;
}
Iterator<BlockInfo> it = s.getBlockIterator();
while (it.hasNext()) {
BlockInfo b = it.next();
if (!initialScan || dn.isEnteringMaintenance()) {
// this is a rescan, so most blocks should be replicated now,
// or this node is going into maintenance. On a healthy
// cluster using racks or upgrade domain, a node should be
// able to go into maintenance without replicating many blocks
// so we will check them immediately.
if (!isBlockReplicatedOk(dn, b, false, null)) {
blockList.put(b, null);
}
} else {
blockList.put(b, null);
}
numBlocksChecked++;
}
} finally {
namesystem.readUnlock();
}
}
```
The rescan would be more expensive as it needs to check if each block is
correctly replicated, and also if you are putting a node to maintenance. The
rescan happens at the end. The initial scan basically puts all the entries into
a list, so it should already be lightweight.
Do you know if the pause is happening at the end of decommission during the
re-scan? If so, we should probably refactor it to not do the
`isBlockReplicatedOk()` check under the lock.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]