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

Possible data loss due to non-handled DroppedSnapshotException for user-triggered flush from client/shell

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.96.2, 0.98.1, 0.99.0
    • Component/s: regionserver
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      During the code review when investigating HBASE-10499, a possibility of data loss due to non-handled DroppedSnapshotException for user-triggered flush is exposed.

      Data loss can happen as below:

      1. A flush for some region is triggered via HBaseAdmin or shell
      2. The request reaches regionserver and eventually HRegion.internalFlushcache is called, then fails at persisting memstore's snapshot to hfile, DroppedSnapshotException is thrown and the snapshot is left not cleared.
      3. DroppedSnapshotException is not handled in HRegion, and is just encapsulated as a ServiceException before returning to client
      4. After a while, some new writes are handled and put in the current memstore, then a new flush is triggered for the region due to memstoreSize exceeds flush threshold
      5. This second(new) flush succeeds, for the HStore which failed in the previous user-triggered flush, the remained non-empty snapshot is used rather than a new snapshot made from the current memstore, but HLog's latest sequenceId is used for the resultant hfiles — the sequenceId attached within the hfiles says all edits with sequenceId <= it have all been persisted, but actually it's not the truth for the edits still in the existing memstore
      6. Now the regionserver hosting this region dies
      7. During the replay phase of failover, the edits corresponding to the ones while are in memstore and not actually persisted in hfiles when the previous regionserver dies will be ignored, since they are deemed as persisted by compared to the hfiles' latest consequenceID — These edits are lost...

      For the second flush, we also can't discard the remained snapshot and make a new one using current memstore, that way the data in the remained snapshot is lost. We should abort the regionserver immediately and rely on the failover to replay the log for data safety.

      DroppedSnapshotException is correctly handled in MemStoreFlusher for internally triggered flush (which are generated by flush-size / rollWriter / periodicFlusher). But user-triggered flush is processed directly by HRegionServer->HRegion without putting a flush entry to flushQueue, hence not handled by MemStoreFlusher

        Attachments

          Activity

            People

            • Assignee:
              fenghh Honghua Feng
              Reporter:
              fenghh Honghua Feng
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: