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

Possible NPE if wal is closed during waledit append.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0-beta-1, 2.0.0
    • None
    • None

    Description

      There is a possible NPE when a wal is closed during waledit append because of not setting write entry to the wal key. Here is the code we are not setting write entry to wal key when when wal is closed.

          if (this.closed) {
            throw new IOException(
                "Cannot append; log is closed, regionName = " + hri.getRegionNameAsString());
          }
          MutableLong txidHolder = new MutableLong();
          MultiVersionConcurrencyControl.WriteEntry we = key.getMvcc().begin(() -> {
            txidHolder.setValue(ringBuffer.next());
          });
          long txid = txidHolder.longValue();
          try (TraceScope scope = TraceUtil.createTrace(implClassName + ".append")) {
            FSWALEntry entry = new FSWALEntry(txid, key, edits, hri, inMemstore);
            entry.stampRegionSequenceId(we);
            ringBuffer.get(txid).load(entry);
          } finally {
            ringBuffer.publish(txid);
          }
          return txid;
      

      But on failure complete on mvcc will be called with nulll write entry cause NPE.

          WriteEntry writeEntry = null;
          try {
            long txid = this.wal.append(this.getRegionInfo(), walKey, walEdit, true);
            // Call sync on our edit.
            if (txid != 0) {
              sync(txid, durability);
            }
            writeEntry = walKey.getWriteEntry();
          } catch (IOException ioe) {
            if (walKey != null) {
              mvcc.complete(walKey.getWriteEntry());
            }
            throw ioe;
          }
      

      We are able to reproduce with mocking in one of the phoenix test cases to test wal replay.

      Attachments

        1. HBASE-19593.patch
          0.7 kB
          Rajeshbabu Chintaguntla

        Activity

          People

            rajeshbabu Rajeshbabu Chintaguntla
            rajeshbabu Rajeshbabu Chintaguntla
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: