Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-15382 Split one FsDatasetImpl lock to volume grain locks.
  3. HDFS-16785

Avoid to hold write lock to improve performance when add volume.

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      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, means that this logic is not in lock before. 

      Attachments

        Issue Links

          Activity

            People

              xuzq_zander ZanderXu
              xuzq_zander ZanderXu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: