Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-15415

Reduce locking in Datanode DirectoryScanner

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.2.2, 3.3.1, 3.4.0
    • datanode
    • None
    • Reviewed

    Description

      In HDFS-15406, we have a small change to greatly reduce the runtime and locking time of the datanode DirectoryScanner. They may be room for further improvement.

      From the scan step, we have captured a snapshot of what is on disk. After calling `dataset.getFinalizedBlocks(bpid);` we have taken a snapshot of in memory. The two snapshots are never 100% in sync as things are always changing as the disk is scanned.

      We are only comparing finalized blocks, so they should not really change:

      • If a block is deleted after our snapshot, our snapshot will not see it and that is OK.
      • A finalized block could be appended. If that happens both the genstamp and length will change, but that should be handled by reconcile when it calls `FSDatasetImpl.checkAndUpdate()`, and there is nothing stopping blocks being appended after they have been scanned from disk, but before they have been compared with memory.

      My suspicion is that we can do all the comparison work outside of the lock and checkAndUpdate() re-checks any differences later under the lock on a block by block basis.

      Attachments

        1. HDFS-15415.branch-3.1.002.patch
          7 kB
          Stephen O'Donnell
        2. HDFS-15415.branch-3.1.001.patch
          7 kB
          Stephen O'Donnell
        3. HDFS-15415.branch-3.2.002.patch
          7 kB
          Stephen O'Donnell
        4. HDFS-15415.branch-3.2.001.patch
          7 kB
          Stephen O'Donnell
        5. HDFS-15415.branch-3.3.001.patch
          7 kB
          Stephen O'Donnell
        6. HDFS-15415.005.patch
          7 kB
          Stephen O'Donnell
        7. HDFS-15415.004.patch
          7 kB
          Stephen O'Donnell
        8. HDFS-15415.003.patch
          7 kB
          Stephen O'Donnell
        9. HDFS-15415.002.patch
          15 kB
          Stephen O'Donnell
        10. HDFS-15415.001.patch
          8 kB
          Stephen O'Donnell

        Issue Links

          Activity

            People

              sodonnell Stephen O'Donnell
              sodonnell Stephen O'Donnell
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: