hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenh...@apache.org
Subject hbase git commit: HBASE-15167 Deadlock in TestNamespaceAuditor.testRegionOperations on 1.1
Date Sat, 06 Feb 2016 14:10:08 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 30707a55e -> 7fc757681


HBASE-15167 Deadlock in TestNamespaceAuditor.testRegionOperations on 1.1


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7fc75768
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7fc75768
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7fc75768

Branch: refs/heads/branch-1.1
Commit: 7fc75768110fcea0664fee4cce3b41e966c455e0
Parents: 30707a5
Author: chenheng <chenheng@apache.org>
Authored: Sat Feb 6 22:02:42 2016 +0800
Committer: chenheng <chenheng@apache.org>
Committed: Sat Feb 6 22:02:42 2016 +0800

----------------------------------------------------------------------
 .../hbase/namespace/TestNamespaceAuditor.java   | 31 +++++++++++++++-----
 1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7fc75768/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
index 22fe916..561b1e4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
@@ -69,6 +69,8 @@ import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.regionserver.RegionServerCoprocessorHost;
+import org.apache.hadoop.hbase.regionserver.Store;
+import org.apache.hadoop.hbase.regionserver.StoreFile;
 import org.apache.hadoop.hbase.snapshot.RestoreSnapshotException;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -455,12 +457,13 @@ public class TestNamespaceAuditor {
     assertEquals(1, stateInfo.getTables().size());
     assertEquals(1, stateInfo.getRegionCount());
     restartMaster();
-    ADMIN.split(tableOne, Bytes.toBytes("500"));
+
     HRegion actualRegion = UTIL.getHBaseCluster().getRegions(tableOne).get(0);
-    CustomObserver observer =
-        (CustomObserver) actualRegion.getCoprocessorHost().findCoprocessor(
-          CustomObserver.class.getName());
+    CustomObserver observer = (CustomObserver) actualRegion.getCoprocessorHost().findCoprocessor(
+        CustomObserver.class.getName());
     assertNotNull(observer);
+
+    ADMIN.split(tableOne, Bytes.toBytes("500"));
     observer.postSplit.await();
     assertEquals(2, ADMIN.getTableRegions(tableOne).size());
     actualRegion = UTIL.getHBaseCluster().getRegions(tableOne).get(0);
@@ -468,10 +471,13 @@ public class TestNamespaceAuditor {
         (CustomObserver) actualRegion.getCoprocessorHost().findCoprocessor(
           CustomObserver.class.getName());
     assertNotNull(observer);
-    ADMIN.split(
-      tableOne,
-      getSplitKey(actualRegion.getRegionInfo().getStartKey(), actualRegion.getRegionInfo()
-          .getEndKey()));
+
+    //Before we go on split, we should remove all reference store files.
+    ADMIN.compact(tableOne);
+    observer.postCompact.await();
+
+    ADMIN.split(tableOne, getSplitKey(actualRegion.getRegionInfo().getStartKey(),
+      actualRegion.getRegionInfo().getEndKey()));
     observer.postSplit.await();
     // Make sure no regions have been added.
     List<HRegionInfo> hris = ADMIN.getTableRegions(tableOne);
@@ -552,6 +558,7 @@ public class TestNamespaceAuditor {
   public static class CustomObserver extends BaseRegionObserver {
     volatile CountDownLatch postSplit;
     volatile CountDownLatch preSplitBeforePONR;
+    volatile CountDownLatch postCompact;
 
     @Override
     public void postCompleteSplit(ObserverContext<RegionCoprocessorEnvironment> ctx)
@@ -560,15 +567,23 @@ public class TestNamespaceAuditor {
     }
 
     @Override
+    public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e,
+                            Store store, StoreFile resultFile) throws IOException {
+      postCompact.countDown();
+    }
+
+    @Override
     public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx,
         byte[] splitKey, List<Mutation> metaEntries) throws IOException {
       preSplitBeforePONR.countDown();
     }
 
+
     @Override
     public void start(CoprocessorEnvironment e) throws IOException {
       postSplit = new CountDownLatch(1);
       preSplitBeforePONR = new CountDownLatch(1);
+      postCompact = new CountDownLatch(1);
     }
   }
 


Mime
View raw message