本文整理汇总了Java中org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State.OPENING属性的典型用法代码示例。如果您正苦于以下问题:Java State.OPENING属性的具体用法?Java State.OPENING怎么用?Java State.OPENING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State
的用法示例。
在下文中一共展示了State.OPENING属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOpening
public boolean isOpening() {
return state == State.OPENING;
}
示例2: testRegionPlanIsUpdatedWhenRegionFailsToOpen
/**
* TestCase verifies that the regionPlan is updated whenever a region fails to open
* and the master tries to process RS_ZK_FAILED_OPEN state.(HBASE-5546).
*/
@Test
public void testRegionPlanIsUpdatedWhenRegionFailsToOpen() throws IOException, KeeperException,
ServiceException, InterruptedException {
this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
MockedLoadBalancer.class, LoadBalancer.class);
AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(this.server,
this.serverManager);
try {
// Boolean variable used for waiting until randomAssignment is called and new
// plan is generated.
AtomicBoolean gate = new AtomicBoolean(false);
if (balancer instanceof MockedLoadBalancer) {
((MockedLoadBalancer) balancer).setGateVariable(gate);
}
ZKAssign.createNodeOffline(this.watcher, REGIONINFO, SERVERNAME_A);
int v = ZKAssign.getVersion(this.watcher, REGIONINFO);
ZKAssign.transitionNode(this.watcher, REGIONINFO, SERVERNAME_A, EventType.M_ZK_REGION_OFFLINE,
EventType.RS_ZK_REGION_FAILED_OPEN, v);
String path = ZKAssign.getNodeName(this.watcher, REGIONINFO.getEncodedName());
RegionState state = new RegionState(REGIONINFO, State.OPENING, System.currentTimeMillis(),
SERVERNAME_A);
am.regionsInTransition.put(REGIONINFO.getEncodedName(), state);
// a dummy plan inserted into the regionPlans. This plan is cleared and new one is formed
am.regionPlans.put(REGIONINFO.getEncodedName(), new RegionPlan(REGIONINFO, null, SERVERNAME_A));
RegionPlan regionPlan = am.regionPlans.get(REGIONINFO.getEncodedName());
List<ServerName> serverList = new ArrayList<ServerName>(2);
serverList.add(SERVERNAME_B);
Mockito.when(this.serverManager.getOnlineServersList()).thenReturn(serverList);
am.nodeDataChanged(path);
// here we are waiting until the random assignment in the load balancer is called.
while (!gate.get()) {
Thread.sleep(10);
}
// new region plan may take some time to get updated after random assignment is called and
// gate is set to true.
RegionPlan newRegionPlan = am.regionPlans.get(REGIONINFO.getEncodedName());
while (newRegionPlan == null) {
Thread.sleep(10);
newRegionPlan = am.regionPlans.get(REGIONINFO.getEncodedName());
}
// the new region plan created may contain the same RS as destination but it should
// be new plan.
assertNotSame("Same region plan should not come", regionPlan, newRegionPlan);
assertTrue("Destnation servers should be different.", !(regionPlan.getDestination().equals(
newRegionPlan.getDestination())));
Mocking.waitForRegionOfflineInRIT(am, REGIONINFO.getEncodedName());
} finally {
this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
DefaultLoadBalancer.class, LoadBalancer.class);
am.shutdown();
}
}