Package org.apache.hadoop.hbase.index.manager

Examples of org.apache.hadoop.hbase.index.manager.IndexManager


    if (IndexUtils.isIndexTable(userTableName)) {
      return;
    }
    LOG.trace("Entering postSplit for the table " + userTableName + " for the region "
        + region.getRegionInfo());
    IndexManager indexManager = IndexManager.getInstance();
    SplitTransaction splitTransaction = null;
    if (indexManager.getIndicesForTable(userTableName) != null) {
      try {
        SplitInfo splitInfo = splitThreadLocal.get();
        splitTransaction = splitInfo.getSplitTransaction();
        PairOfSameType<HRegion> daughters = splitInfo.getDaughters();
        if (splitTransaction != null && daughters != null) {
View Full Code Here


      splits[i] = b;
      c++;
    }
    admin.createTable(ihtd, splits);
    ZKAssign.blockUntilNoRIT(zkw);
    IndexManager instance = IndexManager.getInstance();
    int regionCount = instance.getTableRegionCount(userTableName);
    Assert.assertEquals(11, regionCount);

    admin.disableTable(Bytes.toBytes(userTableName));
    ZKAssign.blockUntilNoRIT(zkw);
    regionCount = instance.getTableRegionCount(userTableName);
    Assert.assertEquals(0, regionCount);

    admin.enableTable(userTableName);
    ZKAssign.blockUntilNoRIT(zkw);
    regionCount = instance.getTableRegionCount(userTableName);
    Assert.assertEquals(11, regionCount);
  }
View Full Code Here

    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);

    IndexManager manager = IndexManager.getInstance();
    int count = manager.getTableRegionCount(userTableName);
    Assert.assertEquals(1, count);

    HTable table = new HTable(conf, userTableName);
    Put p = null;
    for (int i = 0; i < 10; i++) {
      p = new Put(Bytes.toBytes("row" + i));
      p.add(Bytes.toBytes("col1"), Bytes.toBytes("ql"), Bytes.toBytes("test_val"));
      table.put(p);
    }

    admin.split(userTableName, "row5");
    ZKAssign.blockUntilNoRIT(zkw);

    count = manager.getTableRegionCount(userTableName);
    Assert.assertEquals(2, count);
  }
View Full Code Here

    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);

    IndexManager manager = IndexManager.getInstance();
    int count = manager.getTableRegionCount(userTableName);
    Assert.assertEquals(1, count);

    HTable table = new HTable(conf, userTableName);
    Put p = null;
    for (int i = 0; i < 10; i++) {
      p = new Put(Bytes.toBytes("row" + i));
      p.add(Bytes.toBytes("col1"), Bytes.toBytes("ql"), Bytes.toBytes("test_val"));
      table.put(p);
    }

    admin.split(userTableName);
    ZKAssign.blockUntilNoRIT(zkw);

    count = manager.getTableRegionCount(userTableName);
    Assert.assertEquals(1, count);
  }
View Full Code Here

    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);

    IndexManager manager = IndexManager.getInstance();
    int count = manager.getTableRegionCount(userTableName);
    Assert.assertEquals(1, count);

    HTable table = new HTable(conf, userTableName);
    Put p = null;
    for (int i = 0; i < 10; i++) {
      p = new Put(Bytes.toBytes("row" + i));
      p.add(Bytes.toBytes("col1"), Bytes.toBytes("ql"), Bytes.toBytes("test_val"));
      table.put(p);
    }
    List<HRegion> regions = UTIL.getMiniHBaseCluster().getRegions(Bytes.toBytes(userTableName));
    HRegionServer rs = UTIL.getMiniHBaseCluster().getRegionServer(0);
    SplitTransaction st = null;

    st = new MockedSplitTransaction(regions.get(0), null) {
      @Override
      protected void splitStoreFiles(final Path splitdir, final List<StoreFile> hstoreFilesToSplit)
          throws IOException {
        throw new IOException();
      }
    };

    try {
      st.execute(rs, rs);
    } catch (IOException e) {
      st.rollback(rs, rs);
    }

    count = manager.getTableRegionCount(userTableName);
    Assert.assertEquals(1, count);
  }
View Full Code Here

        List<IndexSpecification> indices = ((IndexedHTableDescriptor) htd).getIndices();
        if (indices.isEmpty()) {
          LOG.error("Empty indices are passed to modify the table " + Bytes.toString(tableName));
          return;
        }
        IndexManager idxManager = IndexManager.getInstance();
        idxManager.removeIndices(table);
        idxManager.addIndexForTable(table, indices);
        LOG.info("Successfully updated the indexes for the table  " + table + " to " + indices);
      } else {
        try {
          tableRegionsAndLocations =
              MetaReader.getTableRegionsAndLocations(master.getCatalogTracker(), tableName, true);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.index.manager.IndexManager

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.