From c9ca3ceffa65b26bba44f44f8bbb5e3f25153eac Mon Sep 17 00:00:00 2001 From: jeffreyz Date: Wed, 17 Jul 2013 23:29:22 +0000 Subject: [PATCH] HBASE-8960: TestDistributedLogSplitting.testLogReplayForDisablingTable fails sometimes git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1504321 13f79535-47bb-0310-9956-ffa450edef68 --- .../master/TestDistributedLogSplitting.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java index 53bb9d1c481..97ab8629090 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java @@ -700,18 +700,23 @@ public class TestDistributedLogSplitting { startCluster(NUM_RS, curConf); final int NUM_REGIONS_TO_CREATE = 40; final int NUM_LOG_LINES = 1000; - // turn off load balancing to prevent regions from moving around otherwise - // they will consume recovered.edits - master.balanceSwitch(false); List rsts = cluster.getLiveRegionServerThreads(); final ZooKeeperWatcher zkw = new ZooKeeperWatcher(conf, "table-creation", null); HTable disablingHT = installTable(zkw, "disableTable", "family", NUM_REGIONS_TO_CREATE); HTable ht = installTable(zkw, "table", "family", NUM_REGIONS_TO_CREATE, NUM_REGIONS_TO_CREATE); + // turn off load balancing to prevent regions from moving around otherwise + // they will consume recovered.edits + master.balanceSwitch(false); + List regions = null; HRegionServer hrs = null; + boolean hasRegionsForBothTables = false; + String tableName = null; for (int i = 0; i < NUM_RS; i++) { + tableName = null; + hasRegionsForBothTables = false; boolean isCarryingMeta = false; hrs = rsts.get(i).getRegionServer(); regions = ProtobufUtil.getOnlineRegions(hrs); @@ -720,13 +725,25 @@ public class TestDistributedLogSplitting { isCarryingMeta = true; break; } + if (tableName != null && !tableName.equalsIgnoreCase(region.getTableNameAsString())) { + // make sure that we find a RS has online regions for both "table" and "disableTable" + hasRegionsForBothTables = true; + break; + } else if (tableName == null) { + tableName = region.getTableNameAsString(); + } } if (isCarryingMeta) { continue; } - break; + if (hasRegionsForBothTables) { + break; + } } + // make sure we found a good RS + Assert.assertTrue(hasRegionsForBothTables); + LOG.info("#regions = " + regions.size()); Iterator it = regions.iterator(); while (it.hasNext()) {