Repository: hbase Updated Branches: refs/heads/0.98 bdb828d96 -> 1c2946c40
HBASE-12212 HBaseTestingUtility#waitUntilAllRegionsAssigned should wait for RegionStates Signed-off-by: stack <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1c2946c4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1c2946c4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1c2946c4 Branch: refs/heads/0.98 Commit: 1c2946c409c5cdf96a56b682d32d7b06717ebe01 Parents: bdb828d Author: stack <[email protected]> Authored: Thu Oct 9 16:12:07 2014 -0700 Committer: stack <[email protected]> Committed: Thu Oct 9 20:36:14 2014 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/HBaseTestingUtility.java | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/1c2946c4/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index b93e565..16fd631 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -2903,6 +2903,17 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { } finally { meta.close(); } + // So, all regions are in the meta table but make sure master knows of the assignments before + // returing -- sometimes this can lag. + HMaster master = getHBaseCluster().getMaster(); + final RegionStates states = master.getAssignmentManager().getRegionStates(); + waitFor(timeout, 200, new Predicate<IOException>() { + @Override + public boolean evaluate() throws IOException { + List<HRegionInfo> hris = states.getRegionsOfTable(tableName); + return hris != null && !hris.isEmpty(); + } + }); } /**
