ZanderXu opened a new pull request, #4945:
URL: https://github.com/apache/hadoop/pull/4945

   ### Description of PR
   
   When patching the fine-grained locking of datanode, I  found that 
`addVolume` will hold the write block of the BP lock to scan the new volume to 
get the blocks. If we try to add one full volume that was fixed offline before, 
i will hold the write lock for a long time.
   
   The related code as bellows:
   ```
   for (final NamespaceInfo nsInfo : nsInfos) {
     String bpid = nsInfo.getBlockPoolID();
     try (AutoCloseDataSetLock l = lockManager.writeLock(LockLevel.BLOCK_POOl, 
bpid)) {
       fsVolume.addBlockPool(bpid, this.conf, this.timer);
       fsVolume.getVolumeMap(bpid, tempVolumeMap, ramDiskReplicaTracker);
     } catch (IOException e) {
       LOG.warn("Caught exception when adding " + fsVolume +
           ". Will throw later.", e);
       exceptions.add(e);
     }
   }
   ```
   And I noticed that this lock is added by 
[HDFS-15382](https://issues.apache.org/jira/browse/HDFS-15382), means that this 
logic was not with lock before.
   
   


-- 
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]

Reply via email to