当前位置: 首页>>代码示例>>Java>>正文


Java SecondaryIndexColocator类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.index.util.SecondaryIndexColocator的典型用法代码示例。如果您正苦于以下问题:Java SecondaryIndexColocator类的具体用法?Java SecondaryIndexColocator怎么用?Java SecondaryIndexColocator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SecondaryIndexColocator类属于org.apache.hadoop.hbase.index.util包,在下文中一共展示了SecondaryIndexColocator类的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))));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:24,代码来源:TestSecIndexColocator.java

示例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);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:54,代码来源:TestSecIndexColocator.java

示例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);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:55,代码来源:TestSecIndexColocator.java

示例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);
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:51,代码来源:TestSecIndexColocator.java

示例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);
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:53,代码来源:TestSecIndexColocator.java


注:本文中的org.apache.hadoop.hbase.index.util.SecondaryIndexColocator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。