本文整理汇总了Java中org.apache.hadoop.hbase.master.HMaster.getMasterFileSystem方法的典型用法代码示例。如果您正苦于以下问题:Java HMaster.getMasterFileSystem方法的具体用法?Java HMaster.getMasterFileSystem怎么用?Java HMaster.getMasterFileSystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.master.HMaster
的用法示例。
在下文中一共展示了HMaster.getMasterFileSystem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateTableCalledTwiceAndFirstOneInProgress
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testCreateTableCalledTwiceAndFirstOneInProgress() throws Exception {
final TableName tableName = TableName.valueOf("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.getTableName(), null,
null) };
CustomCreateTableHandler handler = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
desc, cluster.getConfiguration(), hRegionInfos, m);
handler.prepare();
throwException = true;
handler.process();
throwException = false;
CustomCreateTableHandler handler1 = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
desc, cluster.getConfiguration(), hRegionInfos, m);
handler1.prepare();
handler1.process();
for (int i = 0; i < 100; i++) {
if (!TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName)) {
Thread.sleep(200);
}
}
assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(tableName));
}
示例2: 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.valueOf(tableName));
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getTableName(), null,
null) };
CustomCreateTableHandler handler = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
desc, cluster.getConfiguration(), hRegionInfos, m);
handler.prepare();
throwException = true;
handler.process();
abortAndStartNewMaster(cluster);
assertTrue(cluster.getLiveMasterThreads().size() == 1);
}
示例3: 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));
}
示例4: 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);
}
示例5: testCreateTableCalledTwiceAndFirstOneInProgress
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test (timeout=300000)
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.valueOf(tableName));
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getTableName(), null,
null) };
CustomCreateTableHandler handler = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
desc, cluster.getConfiguration(), hRegionInfos, m);
handler.prepare();
throwException = true;
handler.process();
throwException = false;
CustomCreateTableHandler handler1 = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
desc, cluster.getConfiguration(), hRegionInfos, m);
handler1.prepare();
handler1.process();
for (int i = 0; i < 100; i++) {
if (!TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName)) {
Thread.sleep(200);
}
}
assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(tableName));
}
示例6: testCreateTableWithSplitRegion
import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testCreateTableWithSplitRegion() throws Exception {
final TableName tableName = TableName.valueOf("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(desc.getTableName(), null, splitPoint, false, ts);
HRegionInfo d2 = new HRegionInfo(desc.getTableName(), splitPoint, null, false, ts + 1);
HRegionInfo parent = new HRegionInfo(desc.getTableName(), null, null, true, ts + 2);
parent.setOffline(true);
Path tempdir = m.getMasterFileSystem().getTempDir();
FileSystem fs = m.getMasterFileSystem().getFileSystem();
Path tempTableDir = FSUtils.getTableDir(tempdir, desc.getTableName());
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(),
desc, cluster.getConfiguration(), hRegionInfos, m);
handler.prepare();
handler.process();
for (int i = 0; i < 100; i++) {
if (!TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName)) {
Thread.sleep(300);
}
}
assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(tableName));
assertTrue(TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName));
assertTrue(TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName, new byte[][] { splitPoint }));
RegionStates regionStates = m.getAssignmentManager().getRegionStates();
assertTrue("Parent should be in SPLIT state",
regionStates.isRegionInState(parent, State.SPLIT));
}
示例7: 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));
}
示例8: 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.valueOf(tableName));
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
byte[] splitPoint = Bytes.toBytes("split-point");
long ts = System.currentTimeMillis();
HRegionInfo d1 = new HRegionInfo(desc.getTableName(), null, splitPoint, false, ts);
HRegionInfo d2 = new HRegionInfo(desc.getTableName(), splitPoint, null, false, ts + 1);
HRegionInfo parent = new HRegionInfo(desc.getTableName(), null, null, true, ts + 2);
parent.setOffline(true);
Path tempdir = m.getMasterFileSystem().getTempDir();
FileSystem fs = m.getMasterFileSystem().getFileSystem();
Path tempTableDir = FSUtils.getTableDir(tempdir, desc.getTableName());
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(),
desc, cluster.getConfiguration(), hRegionInfos, m);
handler.prepare();
handler.process();
for (int i = 0; i < 100; i++) {
if (!TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName)) {
Thread.sleep(300);
}
}
assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(tableName));
assertTrue(TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName));
assertTrue(TEST_UTIL.getHBaseAdmin().isTableAvailable(tableName, new byte[][] { splitPoint }));
RegionStates regionStates = m.getAssignmentManager().getRegionStates();
assertTrue("Parent should be in SPLIT state",
regionStates.isRegionInState(parent, State.SPLIT));
}