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

Log for flush would append a non-sequential edit in the hlog, leading to possible data loss

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 0.94.1, 0.95.0
    • wal
    • None
    • Reviewed

    Description

      After completing flush region, we will append a log edit in the hlog file through HLog#completeCacheFlush.

      public void completeCacheFlush(final byte [] encodedRegionName,
            final byte [] tableName, final long logSeqId, final boolean isMetaRegion)
      {
      ...
      HLogKey key = makeKey(encodedRegionName, tableName, logSeqId,
                  System.currentTimeMillis(), HConstants.DEFAULT_CLUSTER_ID);
      ...
      }
      

      when we make the hlog key, we use the seqId from the parameter, and it is generated by HLog#startCacheFlush,
      Here, we may append a lower seq id edit than the last edit in the hlog file.

      If it is the last edit log in the file, it may cause data loss.
      because

      HRegion#replayRecoveredEditsIfAny{
      ...
      maxSeqId = Math.abs(Long.parseLong(fileName));
            if (maxSeqId <= minSeqId) {
              String msg = "Maximum sequenceid for this log is " + maxSeqId
                  + " and minimum sequenceid for the region is " + minSeqId
                  + ", skipped the whole file, path=" + edits;
              LOG.debug(msg);
              continue;
            }
      ...
      }
      

      We may skip the splitted log file, because we use the lase edit's seq id as its file name, and consider this seqId as the max seq id in this log file.

      Attachments

        1. HBASE-6065.patch
          0.8 kB
          Chunhui Shen
        2. HBASE-6065v2.patch
          1 kB
          Chunhui Shen

        Issue Links

          Activity

            People

              zjushch Chunhui Shen
              zjushch Chunhui Shen
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: