Package org.apache.hadoop.hbase.index

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor


      throws Exception {
    String tableName = "testDisabledIndexTableEnabledIfUserTableEnabledAndMasterRestarted";
    String indexTableName = IndexUtils.getIndexTableName(tableName);
    HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    IndexedHTableDescriptor iHtd =
        createIndexedHTableDescriptor(tableName, "cf", "index_name", "cf", "cq");
    admin.createTable(iHtd);
    admin.disableTable(indexTableName);
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    cluster.abortMaster(0);
View Full Code Here


      throws Exception {
    String tableName = "testEnabledIndexTableDisabledIfUserTableDisabledAndMasterRestarted";
    String indexTableName = IndexUtils.getIndexTableName(tableName);
    HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    IndexedHTableDescriptor iHtd =
        createIndexedHTableDescriptor(tableName, "cf", "index_name", "cf", "cq");
    admin.createTable(iHtd);
    admin.disableTable(tableName);
    admin.enableTable(indexTableName);
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
View Full Code Here

      throws Exception {
    String tableName = "testDisabledIndexTableEnabledIfUserTableInEnablingAndMasterRestarted";
    String indexTableName = IndexUtils.getIndexTableName(tableName);
    HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    IndexedHTableDescriptor iHtd =
        createIndexedHTableDescriptor(tableName, "cf", "index_name", "cf", "cq");
    admin.createTable(iHtd);
    admin.disableTable(indexTableName);
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    HMaster master = cluster.getMaster();
View Full Code Here

      throws Exception {
    String tableName = "testEnabledIndexTableDisabledIfUserTableInDisablingAndMasterRestarted";
    String indexTableName = IndexUtils.getIndexTableName(tableName);
    HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    IndexedHTableDescriptor iHtd =
        createIndexedHTableDescriptor(tableName, "cf", "index_name", "cf", "cq");
    admin.createTable(iHtd);
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    HMaster master = cluster.getMaster();
    master.getAssignmentManager().getZKTable().setDisablingTable(tableName);
View Full Code Here

  public void testIndexTableShouldBeDeletedIfUserTableDeleted() throws Exception {
    String tableName = "testIndexTableDeletedIfUserTableDeleted";
    String indexTableName = IndexUtils.getIndexTableName(tableName);
    HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    IndexedHTableDescriptor iHtd =
        createIndexedHTableDescriptor(tableName, "cf", "index_name", "cf", "cq");
    admin.createTable(iHtd);
    admin.disableTable(tableName);
    admin.deleteTable(tableName);
    assertFalse("User table should not be available after deletion.",
View Full Code Here

    htd.addFamily(new HColumnDescriptor(Bytes.toBytes("f1")));
    htd.addFamily(new HColumnDescriptor(Bytes.toBytes("f2")));
    admin.createTable(htd);

    admin.disableTable(tableName);
    IndexedHTableDescriptor ihtd =
        createIndexedHTableDescriptor(tableName, "f1", "idx1", "f1", "q1");
    admin.modifyTable(Bytes.toBytes(tableName), ihtd);
    List<HRegionInfo> regionsOfTable =
        UTIL.getHBaseCluster().getMaster().getAssignmentManager()
            .getRegionsOfTable(Bytes.toBytes(tableName + "_idx"));
View Full Code Here

    FileStatus status = getTableInfoPath(fs, path);
    if (null == status) {
      fail("Status should not be null");
    }
    FSDataInputStream fsDataInputStream = fs.open(status.getPath());
    HTableDescriptor iHtd = new IndexedHTableDescriptor();
    iHtd.readFields(fsDataInputStream);
    assertEquals(((IndexedHTableDescriptor) iHtd).getIndices().size(), 2);
    Scan s = new Scan();
    ResultScanner scanner = table.getScanner(s);
    Result[] next = scanner.next(10);
    List<KeyValue> cf1 = next[0].getColumn(Bytes.toBytes("f1"), Bytes.toBytes("q1"));
View Full Code Here

    FileStatus status = getTableInfoPath(fs, path);
    if (null == status) {
      fail("Status should not be null");
    }
    FSDataInputStream fsDataInputStream = fs.open(status.getPath());
    HTableDescriptor iHtd = new IndexedHTableDescriptor();
    iHtd.readFields(fsDataInputStream);
    assertEquals(((IndexedHTableDescriptor) iHtd).getIndices().size(), 1);
    Scan s = new Scan();
    ResultScanner scanner = table.getScanner(s);
    Result[] next = scanner.next(10);
    List<KeyValue> cf1 = next[0].getColumn(Bytes.toBytes("f1"), Bytes.toBytes("q1"));
View Full Code Here

    HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
    Configuration conf = admin.getConfiguration();
    conf.setBoolean("hbase.use.secondary.index", true);
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testBlockEncoding";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col1");

    IndexSpecification iSpec = new IndexSpecification("Index1");

    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);

    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);
    HTable table = new HTable(conf, userTableName + "_idx");
    HTableDescriptor tableDescriptor =
        admin.getTableDescriptor(Bytes.toBytes(userTableName + "_idx"));
View Full Code Here

  @Test(timeout = 180000)
  public void testPostOpenCoprocessor() throws IOException, KeeperException, InterruptedException {
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testPostOpenCoprocessor";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("Index1");
    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);

    // Check the number of indices
    List<IndexSpecification> list = IndexManager.getInstance().getIndicesForTable(userTableName);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.