Repository: hbase Updated Branches: refs/heads/branch-1 2918a8407 -> ab48c0413
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/ab48c041 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ab48c041 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ab48c041 Branch: refs/heads/branch-1 Commit: ab48c0413b5a36c6120d3eeece948a808216f0ec Parents: 2918a84 Author: stack <[email protected]> Authored: Thu Oct 9 16:12:07 2014 -0700 Committer: stack <[email protected]> Committed: Thu Oct 9 20:35:36 2014 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/HBaseTestingUtility.java | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/ab48c041/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 9853e5b..797da7b 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 @@ -2912,6 +2912,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(); + } + }); } /**
