HBASE-5882 (Revert) TestAssginmentManager needs some cleanup
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1340422 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
292e39f392
commit
683c005fca
|
@ -582,11 +582,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
// So we will assign the ROOT and .META. region immediately.
|
// So we will assign the ROOT and .META. region immediately.
|
||||||
processOpeningState(regionInfo);
|
processOpeningState(regionInfo);
|
||||||
break;
|
break;
|
||||||
} else if (deadServers.keySet().contains(sn)) {
|
|
||||||
// if the region is found on a dead server, we can assign
|
|
||||||
// it to a new RS. (HBASE-5882)
|
|
||||||
processOpeningState(regionInfo);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
regionsInTransition.put(encodedRegionName,
|
regionsInTransition.put(encodedRegionName,
|
||||||
getRegionState(regionInfo, RegionState.State.OPENING, rt));
|
getRegionState(regionInfo, RegionState.State.OPENING, rt));
|
||||||
|
@ -625,6 +621,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the region <code>hri</code> into an offline state up in zk.
|
* Put the region <code>hri</code> into an offline state up in zk.
|
||||||
* @param hri
|
* @param hri
|
||||||
|
|
|
@ -472,7 +472,6 @@ public class TestAssignmentManager {
|
||||||
am.regionsInTransition.isEmpty());
|
am.regionsInTransition.isEmpty());
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
am.setEnabledTable(REGIONINFO.getTableNameAsString());
|
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
am.shutdown();
|
am.shutdown();
|
||||||
// Clean up all znodes
|
// Clean up all znodes
|
||||||
|
@ -677,35 +676,6 @@ public class TestAssignmentManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the scenario when the master is in failover and trying to process a
|
|
||||||
* region which is in Opening state on a dead RS. Master should immediately
|
|
||||||
* assign the region and not wait for Timeout Monitor.(Hbase-5882).
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testRegionInOpeningStateOnDeadRSWhileMasterFailover() throws IOException,
|
|
||||||
KeeperException, ServiceException, InterruptedException {
|
|
||||||
AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(this.server,
|
|
||||||
this.serverManager);
|
|
||||||
ZKAssign.createNodeOffline(this.watcher, REGIONINFO, SERVERNAME_A);
|
|
||||||
int version = ZKAssign.getVersion(this.watcher, REGIONINFO);
|
|
||||||
ZKAssign.transitionNode(this.watcher, REGIONINFO, SERVERNAME_A, EventType.M_ZK_REGION_OFFLINE,
|
|
||||||
EventType.RS_ZK_REGION_OPENING, version);
|
|
||||||
RegionTransition rt = RegionTransition.createRegionTransition(EventType.RS_ZK_REGION_OPENING,
|
|
||||||
REGIONINFO.getRegionName(), SERVERNAME_A, HConstants.EMPTY_BYTE_ARRAY);
|
|
||||||
Map<ServerName, List<Pair<HRegionInfo, Result>>> deadServers =
|
|
||||||
new HashMap<ServerName, List<Pair<HRegionInfo, Result>>>();
|
|
||||||
deadServers.put(SERVERNAME_A, null);
|
|
||||||
version = ZKAssign.getVersion(this.watcher, REGIONINFO);
|
|
||||||
am.gate.set(false);
|
|
||||||
am.processRegionsInTransition(rt, REGIONINFO, deadServers, version);
|
|
||||||
// Waiting for the assignment to get completed.
|
|
||||||
while (!am.gate.get()) {
|
|
||||||
Thread.sleep(10);
|
|
||||||
}
|
|
||||||
assertTrue("The region should be assigned immediately.", null != am.regionPlans.get(REGIONINFO
|
|
||||||
.getEncodedName()));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Creates a new ephemeral node in the SPLITTING state for the specified region.
|
* Creates a new ephemeral node in the SPLITTING state for the specified region.
|
||||||
* Create it ephemeral in case regionserver dies mid-split.
|
* Create it ephemeral in case regionserver dies mid-split.
|
||||||
|
@ -841,12 +811,6 @@ public class TestAssignmentManager {
|
||||||
super.processRegionsInTransition(rt, regionInfo, deadServers, expectedVersion);
|
super.processRegionsInTransition(rt, regionInfo, deadServers, expectedVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void assign(HRegionInfo region, boolean setOfflineInZK, boolean forceNewPlan,
|
|
||||||
boolean hijack) {
|
|
||||||
super.assign(region, setOfflineInZK, forceNewPlan, hijack);
|
|
||||||
this.gate.set(true);
|
|
||||||
}
|
|
||||||
/** reset the watcher */
|
/** reset the watcher */
|
||||||
void setWatcher(ZooKeeperWatcher watcher) {
|
void setWatcher(ZooKeeperWatcher watcher) {
|
||||||
this.watcher = watcher;
|
this.watcher = watcher;
|
||||||
|
|
Loading…
Reference in New Issue