本文整理汇总了Java中org.apache.hadoop.hbase.index.util.SecondaryIndexColocator.checkForCoLocationInconsistency方法的典型用法代码示例。如果您正苦于以下问题:Java SecondaryIndexColocator.checkForCoLocationInconsistency方法的具体用法?Java SecondaryIndexColocator.checkForCoLocationInconsistency怎么用?Java SecondaryIndexColocator.checkForCoLocationInconsistency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.index.util.SecondaryIndexColocator
的用法示例。
在下文中一共展示了SecondaryIndexColocator.checkForCoLocationInconsistency方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWhenUserTableIsDisabledButIndexTableIsInEnabledState
import org.apache.hadoop.hbase.index.util.SecondaryIndexColocator; //导入方法依赖的package包/类
@Test(timeout = 180000)
public void testWhenUserTableIsDisabledButIndexTableIsInEnabledState() throws Exception {
String table = "testWhenUserTableIsDisabledButIndexTableIsInEnabledState";
HTableDescriptor htd =
TestUtils.createIndexedHTableDescriptor(table, "cf", "index_name", "cf", "cq");
byte[][] splits = new byte[10][];
char c = 'A';
for (int i = 0; i < 10; i++) {
byte[] b = { (byte) c };
splits[i] = b;
c++;
}
admin.createTable(htd, splits);
admin.disableTable(table);
admin.enableTable(IndexUtils.getIndexTableName(table));
SecondaryIndexColocator colocator = new SecondaryIndexColocator(UTIL.getConfiguration());
colocator.setUp();
colocator.checkForCoLocationInconsistency();
assertTrue(
"The enabled table should be now disabled",
ZKTableReadOnly.isDisabledTable(HBaseTestingUtility.getZooKeeperWatcher(UTIL),
TableName.valueOf(IndexUtils.getIndexTableName(table))));
}
示例2: testWhenUserTableIsEabledButIndexTableIsDisabled
import org.apache.hadoop.hbase.index.util.SecondaryIndexColocator; //导入方法依赖的package包/类
@Test(timeout = 180000)
public void testWhenUserTableIsEabledButIndexTableIsDisabled() throws Exception {
String table = "testWhenUserTableIsEabledButIndexTableIsDisabled";
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(table));
htd.addFamily(new HColumnDescriptor(new String("cf")));
byte[][] splits = new byte[10][];
char c = 'A';
for (int i = 0; i < 10; i++) {
byte[] b = { (byte) c };
splits[i] = b;
c++;
}
admin.createTable(htd, splits);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(UTIL));
String table2 = "testWhenUserTableIsEabledButIndexTableIsDisabled_idx";
TableName tableName2 = TableName.valueOf(table2);
HTableDescriptor htd2 = new HTableDescriptor(tableName2);
htd2.addFamily(new HColumnDescriptor(new String("cf")));
admin.createTable(htd2, splits);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(UTIL));
admin.disableTable(table2);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(UTIL));
List<HRegionInfo> tableRegions = admin.getTableRegions(Bytes.toBytes(table2));
SecondaryIndexColocator colocator = new SecondaryIndexColocator(UTIL.getConfiguration());
colocator.setUp();
boolean inconsistent = colocator.checkForCoLocationInconsistency();
List<RegionServerThread> serverThreads =
UTIL.getMiniHBaseCluster().getLiveRegionServerThreads();
List<HRegionServer> rs = new ArrayList<HRegionServer>();
for (RegionServerThread regionServerThread : serverThreads) {
rs.add(regionServerThread.getRegionServer());
}
List<HRegionInfo> onlineregions = new ArrayList<HRegionInfo>();
for (HRegionServer hrs : rs) {
List<HRegion> regions = hrs.getOnlineRegions(tableName2);
for (HRegion region : regions) {
onlineregions.add(region.getRegionInfo());
}
}
boolean regionOffline = false;
for (HRegionInfo hri : tableRegions) {
if (!onlineregions.contains(hri)) {
regionOffline = true;
break;
}
}
assertFalse("All region from the disabledTable should be online.", regionOffline);
}
示例3: testWhenRegionsAreNotAssignedAccordingToMeta
import org.apache.hadoop.hbase.index.util.SecondaryIndexColocator; //导入方法依赖的package包/类
@Test(timeout = 180000)
public void testWhenRegionsAreNotAssignedAccordingToMeta() throws Exception {
String table = "testWhenRegionsAreNotAssignedAccordingToMeta";
TableName tableName = TableName.valueOf(table);
HTableDescriptor htd = new HTableDescriptor(tableName);
htd.addFamily(new HColumnDescriptor(new String("cf")));
byte[][] splits = new byte[10][];
char c = 'A';
for (int i = 0; i < 10; i++) {
byte[] b = { (byte) c };
splits[i] = b;
c++;
}
admin.createTable(htd, splits);
ServerName sn = ServerName.valueOf("example.org", 1234, 5678);
HMaster master = UTIL.getMiniHBaseCluster().getMaster(0);
List<HRegionInfo> tableRegions = admin.getTableRegions(Bytes.toBytes(table));
List<HRegion> hRegions = UTIL.getMiniHBaseCluster().getRegions(Bytes.toBytes(table));
for (int i = 0; i < 5; i++) {
MetaEditor.updateRegionLocation(master.getCatalogTracker(), tableRegions.get(i), sn, hRegions
.get(i).getOpenSeqNum());
}
SecondaryIndexColocator colocator = new SecondaryIndexColocator(UTIL.getConfiguration());
colocator.setUp();
colocator.checkForCoLocationInconsistency();
List<RegionServerThread> serverThreads =
UTIL.getMiniHBaseCluster().getLiveRegionServerThreads();
List<HRegionServer> rs = new ArrayList<HRegionServer>();
for (RegionServerThread regionServerThread : serverThreads) {
rs.add(regionServerThread.getRegionServer());
}
List<HRegionInfo> onlineregions = new ArrayList<HRegionInfo>();
for (HRegionServer hrs : rs) {
List<HRegion> regions = hrs.getOnlineRegions(tableName);
for (HRegion region : regions) {
onlineregions.add(region.getRegionInfo());
}
}
boolean regionOffline = false;
for (HRegionInfo hri : tableRegions) {
if (!onlineregions.contains(hri)) {
regionOffline = true;
break;
}
}
assertFalse("All the regions with wrong META info should be assiged to some online server.",
regionOffline);
}
示例4: testWhenUserTableIsEabledButIndexTableIsDisabled
import org.apache.hadoop.hbase.index.util.SecondaryIndexColocator; //导入方法依赖的package包/类
@Test(timeout = 180000)
public void testWhenUserTableIsEabledButIndexTableIsDisabled() throws Exception {
String table = "testWhenUserTableIsEabledButIndexTableIsDisabled";
HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
HTableDescriptor htd = new HTableDescriptor(table);
htd.addFamily(new HColumnDescriptor(new String("cf")));
byte[][] splits = new byte[10][];
char c = 'A';
for (int i = 0; i < 10; i++) {
byte[] b = { (byte) c };
splits[i] = b;
c++;
}
admin.createTable(htd, splits);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(UTIL));
String table2 = "testWhenUserTableIsEabledButIndexTableIsDisabled_idx";
HTableDescriptor htd2 = new HTableDescriptor(table2);
htd2.addFamily(new HColumnDescriptor(new String("cf")));
admin.createTable(htd2, splits);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(UTIL));
admin.disableTable(table2);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(UTIL));
List<HRegionInfo> tableRegions = admin.getTableRegions(Bytes.toBytes(table2));
SecondaryIndexColocator colocator = new SecondaryIndexColocator(UTIL.getConfiguration());
colocator.setUp();
boolean inconsistent = colocator.checkForCoLocationInconsistency();
List<RegionServerThread> serverThreads =
UTIL.getMiniHBaseCluster().getLiveRegionServerThreads();
List<HRegionServer> rs = new ArrayList<HRegionServer>();
for (RegionServerThread regionServerThread : serverThreads) {
rs.add(regionServerThread.getRegionServer());
}
Set<HRegionInfo> onlineregions = new HashSet<HRegionInfo>();
for (HRegionServer hrs : rs) {
onlineregions.addAll(hrs.getOnlineRegions());
}
boolean regionOffline = false;
for (HRegionInfo hri : tableRegions) {
if (!onlineregions.contains(hri)) {
regionOffline = true;
break;
}
}
Assert.assertFalse("All region from the disabledTable should be online.", regionOffline);
}
示例5: testWhenRegionsAreNotAssignedAccordingToMeta
import org.apache.hadoop.hbase.index.util.SecondaryIndexColocator; //导入方法依赖的package包/类
@Test(timeout = 180000)
public void testWhenRegionsAreNotAssignedAccordingToMeta() throws Exception {
String table = "testWhenRegionsAreNotAssignedAccordingToMeta";
HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
HTableDescriptor htd = new HTableDescriptor(table);
htd.addFamily(new HColumnDescriptor(new String("cf")));
byte[][] splits = new byte[10][];
char c = 'A';
for (int i = 0; i < 10; i++) {
byte[] b = { (byte) c };
splits[i] = b;
c++;
}
admin.createTable(htd, splits);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(UTIL));
ServerName sn = new ServerName("example.org", 1234, 5678);
HMaster master = UTIL.getMiniHBaseCluster().getMaster(0);
List<HRegionInfo> tableRegions = admin.getTableRegions(Bytes.toBytes(table));
for (int i = 0; i < 5; i++) {
MetaEditor.updateRegionLocation(master.getCatalogTracker(), tableRegions.get(i), sn);
}
SecondaryIndexColocator colocator = new SecondaryIndexColocator(UTIL.getConfiguration());
colocator.setUp();
colocator.checkForCoLocationInconsistency();
List<RegionServerThread> serverThreads =
UTIL.getMiniHBaseCluster().getLiveRegionServerThreads();
List<HRegionServer> rs = new ArrayList<HRegionServer>();
for (RegionServerThread regionServerThread : serverThreads) {
rs.add(regionServerThread.getRegionServer());
}
Set<HRegionInfo> onlineregions = new HashSet<HRegionInfo>();
for (HRegionServer hrs : rs) {
onlineregions.addAll(hrs.getOnlineRegions());
}
boolean regionOffline = false;
for (HRegionInfo hri : tableRegions) {
if (!onlineregions.contains(hri)) {
regionOffline = true;
break;
}
}
Assert.assertFalse(
"All the regions with wrong META info should be assiged to some online server.",
regionOffline);
}