Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-17308

WASB : PageBlobOutputStream succeeding hflush even when underlying flush to storage failed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.7.0
    • 3.3.1
    • None

    Description

      In PageBlobOutputStream, write() APIs will fill the buffer and hflush/hsync/flush call will flush the buffer to underlying storage. Here the Azure calls are handled in another thread

      private synchronized void flushIOBuffers()  {
          ...
          lastQueuedTask = new WriteRequest(outBuffer.toByteArray());
          ioThreadPool.execute(lastQueuedTask);
        ....
       }
      private class WriteRequest implements Runnable {
          private final byte[] dataPayload;
          private final CountDownLatch doneSignal = new CountDownLatch(1);
      
          public WriteRequest(byte[] dataPayload) {
            this.dataPayload = dataPayload;
          }
      
          public void waitTillDone() throws InterruptedException {
            doneSignal.await();
          }
      
          @Override
          public void run() {
            try {
              LOG.debug("before runInternal()");
              runInternal();
              LOG.debug("after runInternal()");
            } finally {
              doneSignal.countDown();
            }
          }
      
          private void runInternal() {
            ......
            writePayloadToServer(rawPayload);
            ...........
          }
      
          private void writePayloadToServer(byte[] rawPayload) {
            ......
            try {
              blob.uploadPages(wrapperStream, currentBlobOffset, rawPayload.length,
                  withMD5Checking(), PageBlobOutputStream.this.opContext);
            } catch (IOException ex) {
              lastError = ex;
            } catch (StorageException ex) {
              lastError = new IOException(ex);
            }
            if (lastError != null) {
              LOG.debug("Caught error in PageBlobOutputStream#writePayloadToServer()");
            }
          }
        }
      

      The flushing thread will wait for the other thread to complete the Runnable WriteRequest. Thats fine. But when some exception happened while blob.uploadPages, we just set that to lastError state variable. This variable is been checked for all subsequent ops like write, flush etc. But what about the current flush call? that is silently being succeeded.!!
      In standard Azure backed HBase clusters WAL is on page blob. This issue causes a serious issue in HBase and causes data loss! HBase think a WAL write was hflushed and make row write successful. In fact the row was never gone to storage.

      Checking the lastError variable at the end of flush op will solve the issue. Then we will throw IOE from this flush() itself.

      Attachments

        Issue Links

          Activity

            People

              anoop.hbase Anoop Sam John
              anoop.hbase Anoop Sam John
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m