hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeffr...@apache.org
Subject svn commit: r1516248 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
Date Wed, 21 Aug 2013 18:35:30 GMT
Author: jeffreyz
Date: Wed Aug 21 18:35:29 2013
New Revision: 1516248

URL: http://svn.apache.org/r1516248
Log:
HBASE-8960: TestDistributedLogSplitting fails sometime - stablize testDisallowWritesInRecovering

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java?rev=1516248&r1=1516247&r2=1516248&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
Wed Aug 21 18:35:29 2013
@@ -775,7 +775,6 @@ public class TestDistributedLogSplitting
     curConf.setBoolean(HConstants.DISALLOW_WRITES_IN_RECOVERING, true);
     startCluster(NUM_RS, curConf);
     final int NUM_REGIONS_TO_CREATE = 40;
-    final int NUM_LOG_LINES = 30000;
     // turn off load balancing to prevent regions from moving around otherwise
     // they will consume recovered.edits
     master.balanceSwitch(false);
@@ -783,33 +782,40 @@ public class TestDistributedLogSplitting
     List<RegionServerThread> rsts = cluster.getLiveRegionServerThreads();
     final ZooKeeperWatcher zkw = new ZooKeeperWatcher(conf, "table-creation", null);
     HTable ht = installTable(zkw, "table", "family", NUM_REGIONS_TO_CREATE);
+    final SplitLogManager slm = master.getMasterFileSystem().splitLogManager;
 
-    HRegionServer hrs = findRSToKill(false, "table");
-    List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(hrs);
-    makeHLog(hrs.getWAL(), regions, "table", "family", NUM_LOG_LINES, 100);
-    
-    // abort RS
-    LOG.info("Aborting region server: " + hrs.getServerName());
-    hrs.abort("testing");
+    Set<HRegionInfo> regionSet = new HashSet<HRegionInfo>();
+    HRegionInfo region = null;
+    HRegionServer hrs = null;
+    HRegionServer dstRS = null;
+    for (int i = 0; i < NUM_RS; i++) {
+      hrs = rsts.get(i).getRegionServer();
+      List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(hrs);
+      if (regions.isEmpty()) continue;
+      region = regions.get(0);
+      regionSet.add(region);
+      dstRS = rsts.get((i+1) % NUM_RS).getRegionServer();
+      break;
+    }
     
-    // wait for abort completes
-    TEST_UTIL.waitFor(120000, 200, new Waiter.Predicate<Exception>() {
+    slm.markRegionsRecoveringInZK(hrs.getServerName(), regionSet);
+    // move region in order for the region opened in recovering state
+    final HRegionInfo hri = region;
+    final HRegionServer tmpRS = dstRS;
+    TEST_UTIL.getHBaseAdmin().move(region.getEncodedNameAsBytes(),
+      Bytes.toBytes(dstRS.getServerName().getServerName()));
+    // wait for region move completes
+    final RegionStates regionStates =
+        TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
+    TEST_UTIL.waitFor(45000, 200, new Waiter.Predicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
-        return (cluster.getLiveRegionServerThreads().size() <= (NUM_RS - 1));
+        ServerName sn = regionStates.getRegionServerOfRegion(hri);
+        return (sn != null && sn.equals(tmpRS.getServerName()));
       }
     });
     
-    // wait for regions come online
-    TEST_UTIL.waitFor(180000, 100, new Waiter.Predicate<Exception>() {
-      @Override
-      public boolean evaluate() throws Exception {
-        return (getAllOnlineRegions(cluster).size() >= (NUM_REGIONS_TO_CREATE + 1));
-      }
-    });
-
     try {
-      HRegionInfo region = regions.get(0);
       byte[] key = region.getStartKey();
       if (key == null || key.length == 0) {
         key = new byte[] { 0, 0, 0, 0, 1 };



Mime
View raw message