本文整理汇总了Java中org.apache.hadoop.hbase.master.HMaster.getAssignmentManager方法的典型用法代码示例。如果您正苦于以下问题:Java HMaster.getAssignmentManager方法的具体用法?Java HMaster.getAssignmentManager怎么用?Java HMaster.getAssignmentManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.master.HMaster
的用法示例。
在下文中一共展示了HMaster.getAssignmentManager方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMoveToPreviouslyAssignedRS
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testMoveToPreviouslyAssignedRS() throws IOException, InterruptedException {
byte[] tableName = Bytes.toBytes("testMoveToPreviouslyAssignedRS");
MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
HMaster master = cluster.getMaster();
HBaseAdmin localAdmin = createTable(tableName);
List<HRegionInfo> tableRegions = localAdmin.getTableRegions(tableName);
HRegionInfo hri = tableRegions.get(0);
AssignmentManager am = master.getAssignmentManager();
assertTrue("Region " + hri.getRegionNameAsString()
+ " should be assigned properly", am.waitForAssignment(hri));
ServerName server = am.getRegionStates().getRegionServerOfRegion(hri);
localAdmin.move(hri.getEncodedNameAsBytes(), Bytes.toBytes(server.getServerName()));
assertEquals("Current region server and region server before move should be same.", server,
am.getRegionStates().getRegionServerOfRegion(hri));
}
示例2: testCreateTableCalledTwiceAndFirstOneInProgress
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test
public void testCreateTableCalledTwiceAndFirstOneInProgress() throws Exception {
final byte[] tableName = Bytes.toBytes("testCreateTableCalledTwiceAndFirstOneInProgress");
final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
final HMaster m = cluster.getMaster();
final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getName(), null,
null) };
CustomCreateTableHandler handler = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
m.getServerManager(), desc, cluster.getConfiguration(), hRegionInfos,
m.getCatalogTracker(), m.getAssignmentManager());
throwException = true;
handler.process();
throwException = false;
CustomCreateTableHandler handler1 = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
m.getServerManager(), desc, cluster.getConfiguration(), hRegionInfos,
m.getCatalogTracker(), m.getAssignmentManager());
handler1.process();
for (int i = 0; i < 100; i++) {
if (!TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName)) {
Thread.sleep(200);
}
}
assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(tableName));
}
示例3: testMasterRestartAfterEnablingNodeIsCreated
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test (timeout=60000)
public void testMasterRestartAfterEnablingNodeIsCreated() throws Exception {
byte[] tableName = Bytes.toBytes("testMasterRestartAfterEnablingNodeIsCreated");
final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
final HMaster m = cluster.getMaster();
final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getName(), null,
null) };
CustomCreateTableHandler handler = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
m.getServerManager(), desc, cluster.getConfiguration(), hRegionInfos,
m.getCatalogTracker(), m.getAssignmentManager());
throwException = true;
handler.process();
abortAndStartNewMaster(cluster);
assertTrue(cluster.getLiveMasterThreads().size() == 1);
}
示例4: waitForRITtoBeZero
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
private void waitForRITtoBeZero(HMaster master) throws Exception {
// wait for assignments to finish
AssignmentManager mgr = master.getAssignmentManager();
Collection<RegionState> transRegions =
mgr.getRegionStates().getRegionsInTransition().values();
for (RegionState state : transRegions) {
mgr.getRegionStates().waitOnRegionToClearRegionsInTransition(state.getRegion());
}
}
示例5: testCreateTableWithSplitRegion
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testCreateTableWithSplitRegion() throws Exception {
final byte[] tableName = Bytes.toBytes("testCreateTableWithSplitRegion");
final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
final HMaster m = cluster.getMaster();
final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
byte[] splitPoint = Bytes.toBytes("split-point");
long ts = System.currentTimeMillis();
HRegionInfo d1 = new HRegionInfo(tableName, null, splitPoint, false, ts);
HRegionInfo d2 = new HRegionInfo(tableName, splitPoint, null, false, ts + 1);
HRegionInfo parent = new HRegionInfo(tableName, null, null, true, ts + 2);
parent.setOffline(true);
Path tempdir = m.getMasterFileSystem().getTempDir();
FileSystem fs = m.getMasterFileSystem().getFileSystem();
Path tempTableDir = FSUtils.getTablePath(tempdir, tableName);
fs.delete(tempTableDir, true); // Clean up temp table dir if exists
final HRegionInfo[] hRegionInfos = new HRegionInfo[] {d1, d2, parent};
CreateTableHandler handler = new CreateTableHandler(m, m.getMasterFileSystem(),
m.getServerManager(), desc, cluster.getConfiguration(), hRegionInfos,
m.getCatalogTracker(), m.getAssignmentManager());
handler.process();
for (int i = 0; i < 200; i++) {
if (!TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName)) {
Thread.sleep(300);
}
}
assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(tableName));
assertTrue(TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName));
List<HRegionInfo> regions = m.getAssignmentManager().getRegionsOfTable(tableName);
assertFalse("Split parent should not be assigned", regions.contains(parent));
}
示例6: waitForRITtoBeZero
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
private void waitForRITtoBeZero(HMaster master) throws IOException {
// wait for assignments to finish
AssignmentManager mgr = master.getAssignmentManager();
Collection<AssignmentManager.RegionState> transRegions =
mgr.getRegionsInTransition().values();
for (AssignmentManager.RegionState state : transRegions) {
mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
}
}
示例7: clearRegionPlans
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
private void clearRegionPlans(HMaster master, String tableName) {
AssignmentManager am = master.getAssignmentManager();
if (am.getBalancer() instanceof SecIndexLoadBalancer) {
((SecIndexLoadBalancer) am.getBalancer()).clearTableRegionPlans(tableName);
}
}