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:
parent
a246cbbd6c
commit
83470f981a
|
@ -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.
|
||||
* @param regionName
|
||||
|
|
|
@ -76,8 +76,12 @@ public class DisableTableHandler extends EventHandler {
|
|||
// TODO: Confirm we have parallel closing going on.
|
||||
List<HRegionInfo> regions = assignmentManager.getRegionsOfTable(tableName);
|
||||
// Unassign the online regions
|
||||
for(HRegionInfo region : regions) {
|
||||
for(HRegionInfo region: regions) {
|
||||
assignmentManager.unassign(region);
|
||||
}
|
||||
// Wait on table's regions to clear region in transition.
|
||||
for (HRegionInfo region: regions) {
|
||||
this.assignmentManager.waitOnRegionToClearRegionsInTransition(region);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -75,5 +75,9 @@ public class EnableTableHandler extends EventHandler {
|
|||
for (HRegionInfo region : regions) {
|
||||
assignmentManager.assign(region);
|
||||
}
|
||||
// Wait on table's regions to clear region in transition.
|
||||
for (HRegionInfo region: regions) {
|
||||
this.assignmentManager.waitOnRegionToClearRegionsInTransition(region);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue