Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-16643

Reverse scanner heap creation may not allow MSLAB closure due to improper ref counting of segments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • 2.0.0
    • None
    • None
    • Reviewed

    Description

      In the reverse scanner case,
      While doing 'initBackwardHeapIfNeeded' in MemstoreScanner for setting the backward heap, we do a

      if ((backwardHeap == null) && (forwardHeap != null)) {
              forwardHeap.close();
              forwardHeap = null;
              // before building the heap seek for the relevant key on the scanners,
              // for the heap to be built from the scanners correctly
              for (KeyValueScanner scan : scanners) {
                if (toLast) {
                  res |= scan.seekToLastRow();
                } else {
                  res |= scan.backwardSeek(cell);
                }
              }
      

      forwardHeap.close(). This would internally decrement the MSLAB ref counter for the current active segment and snapshot segment.
      When the scan is actually closed again we do close() and that will again decrement the count. Here chances are there that the count would go negative and hence the actual MSLAB closure that checks for refCount==0 will fail. Apart from this, when the refCount becomes 0 after the firstClose if any other thread requests to close the segment, then we will end up in corrupted segment because the segment could be put back to the MSLAB pool.

      Attachments

        1. HBASE-16643_1.patch
          48 kB
          ramkrishna.s.vasudevan
        2. HBASE-16643_2.patch
          48 kB
          ramkrishna.s.vasudevan
        3. HBASE-16643_3.patch
          19 kB
          ramkrishna.s.vasudevan
        4. HBASE-16643_4.patch
          20 kB
          ramkrishna.s.vasudevan
        5. HBASE-16643_5.patch
          21 kB
          ramkrishna.s.vasudevan
        6. HBASE-16643_6.patch
          24 kB
          ramkrishna.s.vasudevan
        7. HBASE-16643_7.patch
          21 kB
          ramkrishna.s.vasudevan
        8. HBASE-16643_8.patch
          21 kB
          ramkrishna.s.vasudevan
        9. HBASE-16643.patch
          48 kB
          ramkrishna.s.vasudevan

        Issue Links

          Activity

            People

              ram_krish ramkrishna.s.vasudevan
              ram_krish ramkrishna.s.vasudevan
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: