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

ramkrishna.s.vasudevan commented on HBASE-5689:
-----------------------------------------------

@Chunhui
Thanks for the patch.
I would like to tell my analysis in this
-> Suppose the current  seq for RS 1 is 4
When the first row kv was inserted KV(r1->v1), the current seq is 5.
On moving the region to RS2 the store gets flushed and when RS2 opens the 
region the next seq he can use will be 6.
Now we make the next kv entry KV(r2->v1), now the current seq for this entry is 
6. Now when the region is moved again to RS1, another store file is created by 
RS2.
Now when RS1 opens the region the seq number which he can use will be 7.

We now add an entry KV(r3->v1) again in RS1 so it will have 7 in it (in WAL).

Kill the RS2 first.  This will create a recovered.edits with file name 000006.

Kill RS1.   This will create a recovered.edits with file name 00005.

Now when the region is finally opened in a new RS i will be having the 2 store 
files and the max seq id from them will be 6.  Now the recovered.edits will 
also give me 6 as highest seq.  
{code}
      if (maxSeqId <= minSeqId) {
          String msg = "Maximum possible sequenceid for this log is " + maxSeqId
              + ", skipped the whole file, path=" + edits;
          LOG.debug(msg);
          continue;
{code}
Correct me my analysis is wrong.


                
> Skip RecoveredEdits may cause data loss
> ---------------------------------------
>
>                 Key: HBASE-5689
>                 URL: https://issues.apache.org/jira/browse/HBASE-5689
>             Project: HBase
>          Issue Type: Bug
>          Components: regionserver
>            Reporter: chunhui shen
>            Assignee: chunhui shen
>         Attachments: 5689-testcase.patch, HBASE-5689.patch
>
>
> Let's see the following scenario:
> 1.Region is on the server A
> 2.put KV(r1->v1) to the region
> 3.move region from server A to server B
> 4.put KV(r2->v2) to the region
> 5.move region from server B to server A
> 6.put KV(r3->v3) to the region
> 7.kill -9 server B and start it
> 8.kill -9 server A and start it 
> 9.scan the region, we could only get two KV(r1->v1,r2->v2), the third 
> KV(r3->v3) is lost.
> Let's analyse the upper scenario from the code:
> 1.the edit logs of KV(r1->v1) and KV(r3->v3) are both recorded in the same 
> hlog file on server A.
> 2.when we split server B's hlog file in the process of ServerShutdownHandler, 
> we create one RecoveredEdits file f1 for the region.
> 2.when we split server A's hlog file in the process of ServerShutdownHandler, 
> we create another RecoveredEdits file f2 for the region.
> 3.however, RecoveredEdits file f2 will be skiped when initializing region
> HRegion#replayRecoveredEditsIfAny
> {code}
>  for (Path edits: files) {
>       if (edits == null || !this.fs.exists(edits)) {
>         LOG.warn("Null or non-existent edits file: " + edits);
>         continue;
>       }
>       if (isZeroLengthThenDelete(this.fs, edits)) continue;
>       if (checkSafeToSkip) {
>         Path higher = files.higher(edits);
>         long maxSeqId = Long.MAX_VALUE;
>         if (higher != null) {
>           // Edit file name pattern, HLog.EDITFILES_NAME_PATTERN: "-?[0-9]+"
>           String fileName = higher.getName();
>           maxSeqId = Math.abs(Long.parseLong(fileName));
>         }
>         if (maxSeqId <= minSeqId) {
>           String msg = "Maximum possible sequenceid for this log is " + 
> maxSeqId
>               + ", skipped the whole file, path=" + edits;
>           LOG.debug(msg);
>           continue;
>         } else {
>           checkSafeToSkip = false;
>         }
>       }
> {code}
>  

--
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

        

Reply via email to