You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Zhihong Yu (JIRA)" <ji...@apache.org> on 2012/05/23 22:19:41 UTC

[jira] [Commented] (HBASE-6065) Log for flush would append a non-sequential edit in the hlog, leading to possible data loss

    [ https://issues.apache.org/jira/browse/HBASE-6065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281868#comment-13281868 ] 

Zhihong Yu commented on HBASE-6065:
-----------------------------------

Integrated to 0.94 and trunk.

Thanks for the patch Chunhui.

Thanks for the review, Ramkrishna.
                
> Log for flush would append a non-sequential edit in the hlog, leading to possible data loss
> -------------------------------------------------------------------------------------------
>
>                 Key: HBASE-6065
>                 URL: https://issues.apache.org/jira/browse/HBASE-6065
>             Project: HBase
>          Issue Type: Bug
>          Components: wal
>            Reporter: chunhui shen
>            Assignee: chunhui shen
>            Priority: Critical
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: HBASE-6065.patch, HBASE-6065v2.patch
>
>
> After completing flush region, we will append a log edit in the hlog file through HLog#completeCacheFlush.
> {code}
> 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);
> ...
> }
> {code}
> 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 
> {code}
> 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;
>       }
> ...
> }
> {code}
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira