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

Introduce read write lock to Datanode



    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.3.0, 2.10.2, 3.2.3, 3.2.4
    • datanode
    • None


      HDFS-9668 pointed out the issues around the DN lock being a point of contention some time ago, but that Jira went in a direction of creating a new FSDataset implementation which is very risky, and activity on the Jira has stalled for a few years now. Edit: Looks like HDFS-9668 eventually went in a similar direction to what I was thinking, so I will review that Jira in more detail to see if this one is necessary.

      I feel there could be significant gains by moving to a ReentrantReadWrite lock within the DN. The current implementation is simply a ReentrantLock so any locker blocks all others.

      Once place I think a read lock would benefit us significantly, is when the DN is serving a lot of small blocks and there are jobs which perform a lot of reads. The start of reading any blocks right now takes the lock, but if we moved this to a read lock, many reads could do this at the same time.

      The first conservative step, would be to change the current lock and then make all accesses to it obtain the write lock. That way, we should keep the current behaviour and then we can selectively move some lock accesses to the readlock in separate Jiras.

      I would appreciate any thoughts on this, and also if anyone has attempted it before and found any blockers.


        1. HDFS-15150.001.patch
          46 kB
          Stephen O'Donnell
        2. HDFS-15150.002.patch
          46 kB
          Stephen O'Donnell
        3. HDFS-15150.003.patch
          49 kB
          Stephen O'Donnell
        4. HDFS-15150-branch-2.10.001.patch
          46 kB
          Ahmed Hussein
        5. HDFS-15150-branch-2.10.002.patch
          47 kB
          Ahmed Hussein
        6. HDFS-15150-branch-2.10.003.patch
          46 kB
          Ahmed Hussein

        Issue Links



              sodonnell Stephen O'Donnell
              sodonnell Stephen O'Donnell
              0 Vote for this issue
              15 Start watching this issue