You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2011/10/17 23:01:05 UTC

svn commit: r1185374 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java

Author: larsh
Date: Mon Oct 17 21:01:05 2011
New Revision: 1185374

URL: http://svn.apache.org/viewvc?rev=1185374&view=rev
Log:
HBASE-4562  When split doing offlineParentInMeta encounters error, it'll cause data loss

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1185374&r1=1185373&r2=1185374&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Mon Oct 17 21:01:05 2011
@@ -81,6 +81,8 @@ Release 0.90.5 - Unreleased
    HBASE-4570. Fix a race condition that could cause inconsistent results
                from scans during concurrent writes. (todd and Jonathan Jsieh
                via todd)
+   HBASE-4562  When split doing offlineParentInMeta encounters error, it'll cause data loss
+               (bluedavy via Lars H)
 
   IMPROVEMENT
    HBASE-4205  Enhance HTable javadoc (Eric Charles)

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java?rev=1185374&r1=1185373&r2=1185374&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java Mon Oct 17 21:01:05 2011
@@ -258,18 +258,6 @@ class SplitTransaction {
     this.journal.add(JournalEntry.STARTED_REGION_B_CREATION);
     HRegion b = createDaughterRegion(this.hri_b, this.parent.flushRequester);
 
-    // Edit parent in meta.  Offlines parent region and adds splita and splitb.
-    // TODO: This can 'fail' by timing out against .META. but the edits could
-    // be applied anyways over on the server.  There is no way to tell for sure.
-    // We could try and get the edits again subsequent to their application
-    // whether we fail or not but that could fail too.  We should probably move
-    // the PONR to here before the edits go in but could mean we'd abort the
-    // regionserver when we didn't need to; i.e. the edits did not make it in.
-    if (!testing) {
-      MetaEditor.offlineParentInMeta(server.getCatalogTracker(),
-        this.parent.getRegionInfo(), a.getRegionInfo(), b.getRegionInfo());
-    }
-
     // This is the point of no return.  Adding subsequent edits to .META. as we
     // do below when we do the daughter opens adding each to .META. can fail in
     // various interesting ways the most interesting of which is a timeout
@@ -281,7 +269,18 @@ class SplitTransaction {
     // crash out, then they will have their references to the parent in place
     // still and the server shutdown fixup of .META. will point to these
     // regions.
+    // We should add PONR JournalEntry before offlineParentInMeta,so even if
+    // OfflineParentInMeta timeout,this will cause regionserver exit,and then
+    // master ServerShutdownHandler will fix daughter & avoid data loss. See (
+    // HBASE-4562).
     this.journal.add(JournalEntry.PONR);
+
+    // Edit parent in meta.  Offlines parent region and adds splita and splitb.
+    if (!testing) {
+      MetaEditor.offlineParentInMeta(server.getCatalogTracker(),
+        this.parent.getRegionInfo(), a.getRegionInfo(), b.getRegionInfo());
+    }
+
     // Open daughters in parallel.
     DaughterOpener aOpener = new DaughterOpener(server, services, a);
     DaughterOpener bOpener = new DaughterOpener(server, services, b);