[
https://issues.apache.org/jira/browse/HDFS-16438?focusedWorklogId=716344&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-716344
]
ASF GitHub Bot logged work on HDFS-16438:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 27/Jan/22 10:43
Start Date: 27/Jan/22 10:43
Worklog Time Spent: 10m
Work Description: 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]
Issue Time Tracking
-------------------
Worklog Id: (was: 716344)
Time Spent: 1h 40m (was: 1.5h)
> Avoid holding read locks for a long time when scanDatanodeStorage
> -----------------------------------------------------------------
>
> Key: HDFS-16438
> URL: https://issues.apache.org/jira/browse/HDFS-16438
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: tomscut
> Assignee: tomscut
> Priority: Major
> Labels: pull-request-available
> Attachments: image-2022-01-25-23-18-30-275.png
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> At the time of decommission, if use {*}DatanodeAdminBackoffMonitor{*}, there
> is a heavy operation: {*}scanDatanodeStorage{*}. If the number of blocks on a
> storage is large(more than 5 hundred thousand), and GC performance is also
> poor, it may hold *read lock* for a long time, we should optimize it.
> !image-2022-01-25-23-18-30-275.png|width=764,height=193!
> {code:java}
> 2021-12-22 07:49:01,279 INFO namenode.FSNamesystem
> (FSNamesystemLock.java:readUnlock(220)) - FSNamesystem scanDatanodeStorage
> read lock held for 5491 ms via
> java.lang.Thread.getStackTrace(Thread.java:1552)
> org.apache.hadoop.util.StringUtils.getStackTrace(StringUtils.java:1032)
> org.apache.hadoop.hdfs.server.namenode.FSNamesystemLock.readUnlock(FSNamesystemLock.java:222)
> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.readUnlock(FSNamesystem.java:1641)
> org.apache.hadoop.hdfs.server.blockmanagement.DatanodeAdminBackoffMonitor.scanDatanodeStorage(DatanodeAdminBackoffMonitor.java:646)
> org.apache.hadoop.hdfs.server.blockmanagement.DatanodeAdminBackoffMonitor.checkForCompletedNodes(DatanodeAdminBackoffMonitor.java:417)
> org.apache.hadoop.hdfs.server.blockmanagement.DatanodeAdminBackoffMonitor.check(DatanodeAdminBackoffMonitor.java:300)
> org.apache.hadoop.hdfs.server.blockmanagement.DatanodeAdminBackoffMonitor.run(DatanodeAdminBackoffMonitor.java:201)
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> java.lang.Thread.run(Thread.java:745)
> Number of suppressed read-lock reports: 0
> Longest read-lock held interval: 5491 {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]