HBASE-3080 TestAdmin hanging on hudson

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1004525 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-10-05 05:03:22 +00:00
parent a246cbbd6c
commit 83470f981a
3 changed files with 30 additions and 1 deletions

View File

@ -1009,6 +1009,27 @@ public class AssignmentManager extends ZooKeeperListener {
} }
} }
/**
* Wait on regions to clean regions-in-transition.
* @param hri Region to wait on.
* @throws IOException
*/
public void waitOnRegionToClearRegionsInTransition(final HRegionInfo hri)
throws IOException {
if (isRegionInTransition(hri) == null) return;
RegionState rs = null;
// There is already a timeout monitor on regions in transition so I
// should not have to have one here too?
while(!this.master.isStopped() && (rs = isRegionInTransition(hri)) != null) {
Threads.sleep(1000);
LOG.info("Waiting on " + rs + " to clear regions-in-transition");
}
if (this.master.isStopped()) {
LOG.info("Giving up wait on regions in " +
"transition because stoppable.isStopped is set");
}
}
/** /**
* Checks if the table of the specified region has been disabled by the user. * Checks if the table of the specified region has been disabled by the user.
* @param regionName * @param regionName

View File

@ -76,8 +76,12 @@ public class DisableTableHandler extends EventHandler {
// TODO: Confirm we have parallel closing going on. // TODO: Confirm we have parallel closing going on.
List<HRegionInfo> regions = assignmentManager.getRegionsOfTable(tableName); List<HRegionInfo> regions = assignmentManager.getRegionsOfTable(tableName);
// Unassign the online regions // Unassign the online regions
for(HRegionInfo region : regions) { for(HRegionInfo region: regions) {
assignmentManager.unassign(region); assignmentManager.unassign(region);
} }
// Wait on table's regions to clear region in transition.
for (HRegionInfo region: regions) {
this.assignmentManager.waitOnRegionToClearRegionsInTransition(region);
}
} }
} }

View File

@ -75,5 +75,9 @@ public class EnableTableHandler extends EventHandler {
for (HRegionInfo region : regions) { for (HRegionInfo region : regions) {
assignmentManager.assign(region); assignmentManager.assign(region);
} }
// Wait on table's regions to clear region in transition.
for (HRegionInfo region: regions) {
this.assignmentManager.waitOnRegionToClearRegionsInTransition(region);
}
} }
} }