HBASE-12212 HBaseTestingUtility#waitUntilAllRegionsAssigned should wait for RegionStates

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
stack 2014-10-09 16:12:07 -07:00
parent 712dad814c
commit 8915130dd7
1 changed files with 11 additions and 0 deletions

View File

@ -3045,6 +3045,17 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
} finally { } finally {
meta.close(); 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();
}
});
} }
/** /**