Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Admin.createTable()


        ProtobufCoprocessorService.class.getName());
    util.startMiniCluster(2);
    Admin admin = new HBaseAdmin(conf);
    HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
    desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
    admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
    util.waitUntilAllRegionsAssigned(TEST_TABLE);
    admin.close();

    Table table = new HTable(conf, TEST_TABLE);
    for (int i = 0; i < ROWSIZE; i++) {
View Full Code Here


    htd1.addFamily(new HColumnDescriptor(TEST_FAMILY1));

    boolean threwDNRE = false;
    try {
      Admin admin = UTIL.getHBaseAdmin();
      admin.createTable(htd1);
    } catch (IOException e) {
      if (e.getClass().getName().equals("org.apache.hadoop.hbase.DoNotRetryIOException")) {
        threwDNRE = true;
      }
    } finally {
View Full Code Here

    // by creating another table: should not have a problem this time.
    HTableDescriptor htd2 = new HTableDescriptor(TableName.valueOf(TEST_TABLE2));
    htd2.addFamily(new HColumnDescriptor(TEST_FAMILY2));
    Admin admin = UTIL.getHBaseAdmin();
    try {
      admin.createTable(htd2);
    } catch (IOException e) {
      fail("Failed to create table after buggy coprocessor removal: " + e);
    }
  }
View Full Code Here

      RegionServerCoprocessorHost cpHost = regionServer.getRegionServerCoprocessorHost();
      Coprocessor coprocessor = cpHost.findCoprocessor(CPRegionServerObserver.class.getName());
      CPRegionServerObserver regionServerObserver = (CPRegionServerObserver) coprocessor;
      HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(TABLENAME));
      desc.addFamily(new HColumnDescriptor(FAM));
      admin.createTable(desc, new byte[][] { Bytes.toBytes("row") });
      desc = new HTableDescriptor(TableName.valueOf(TABLENAME2));
      desc.addFamily(new HColumnDescriptor(FAM));
      admin.createTable(desc, new byte[][] { Bytes.toBytes("row") });
      assertFalse(regionServerObserver.wasRegionMergeCalled());
      List<HRegion> regions = regionServer.getOnlineRegions(TableName.valueOf(TABLENAME));
View Full Code Here

      HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(TABLENAME));
      desc.addFamily(new HColumnDescriptor(FAM));
      admin.createTable(desc, new byte[][] { Bytes.toBytes("row") });
      desc = new HTableDescriptor(TableName.valueOf(TABLENAME2));
      desc.addFamily(new HColumnDescriptor(FAM));
      admin.createTable(desc, new byte[][] { Bytes.toBytes("row") });
      assertFalse(regionServerObserver.wasRegionMergeCalled());
      List<HRegion> regions = regionServer.getOnlineRegions(TableName.valueOf(TABLENAME));
      admin.mergeRegions(regions.get(0).getRegionInfo().getEncodedNameAsBytes(), regions.get(1)
          .getRegionInfo().getEncodedNameAsBytes(), true);
      int regionsCount = regionServer.getOnlineRegions(TableName.valueOf(TABLENAME)).size();
View Full Code Here

    desc.addCoprocessor(EmptyRegionObsever.class.getName(), null, Coprocessor.PRIORITY_USER, null);
    desc.addCoprocessor(NoDataFromCompaction.class.getName(), null, Coprocessor.PRIORITY_HIGHEST,
      null);

    Admin admin = UTIL.getHBaseAdmin();
    admin.createTable(desc);

    Table table = new HTable(conf, desc.getTableName());

    // put a row and flush it to disk
    Put put = new Put(ROW);
View Full Code Here

    HTableDescriptor htd = new HTableDescriptor(TEST_TABLE);
    htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
    Admin admin = UTIL.getHBaseAdmin();

    tableCreationLatch = new CountDownLatch(1);
    admin.createTable(htd);
    tableCreationLatch.await();
    tableCreationLatch = new CountDownLatch(1);

    admin.disableTable(TEST_TABLE);
    assertTrue(admin.isTableDisabled(TEST_TABLE));
View Full Code Here

      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
      colDesc.setMaxVersions(5);
      HTableDescriptor desc = new HTableDescriptor(tableName);
      desc.addFamily(colDesc);
      hBaseAdmin.createTable(desc);
      table = new HTable(conf, tableName);
      Put put = new Put(Bytes.toBytes("row1"));
      put.add(fam, qual, value);
      put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
      table.put(put);
View Full Code Here

      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
      colDesc.setMaxVersions(5);
      HTableDescriptor desc = new HTableDescriptor(tableName);
      desc.addFamily(colDesc);
      hBaseAdmin.createTable(desc);
      table = new HTable(conf, tableName);
      Put put = new Put(Bytes.toBytes("row1"));
      put.add(fam, qual, value);
      put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
      table.put(put);
View Full Code Here

      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
      colDesc.setMaxVersions(5);
      HTableDescriptor desc = new HTableDescriptor(tableName);
      desc.addFamily(colDesc);
      hBaseAdmin.createTable(desc);
      table = new HTable(conf, tableName);
      Put put = new Put(Bytes.toBytes("row1"));
      put.add(fam, qual, 123l, value);
      put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
      table.put(put);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.