Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.modifyTable()


          HTableDescriptor htd = admin.getTableDescriptor(tableName);
          String val = String.valueOf(random.nextInt());
          htd.getFamily(family).setValue(val, val);
          desc.getFamily(family).setValue(val, val); // save it for later
                                                     // control
          admin.modifyTable(tableName, htd);
        } catch (Exception ex) {
          LOG.warn("Caught exception", ex);
          fail(ex.getMessage());
        }
      }
View Full Code Here


    // disable table before modification
    admin.disableTable(tableName);

    User newOwner = User.createUserForTesting(conf, "new_owner", new String[] {});
    htd.setOwner(newOwner);
    admin.modifyTable(tableName, htd);

    acl = new HTable(conf, AccessControlLists.ACL_TABLE_NAME);
    try {
      AccessControllerProtocol protocol = acl.coprocessorProxy(AccessControllerProtocol.class,
        tableName);
View Full Code Here

    // disable table before modification
    admin.disableTable(tableName);

    User newOwner = User.createUserForTesting(conf, "new_owner", new String[] {});
    htd.setOwner(newOwner);
    admin.modifyTable(tableName, htd);

    acl = new HTable(conf, AccessControlLists.ACL_TABLE_NAME);
    try {
      AccessControllerProtocol protocol = acl.coprocessorProxy(AccessControllerProtocol.class,
        tableName);
View Full Code Here

      assertNotNull(status);

      HTableDescriptor htd = admin.getTableDescriptor(table.getBytes());
      htd.setValue("NOT_DEFAULT", "true");
      admin.disableTable(table);
      admin.modifyTable(table.getBytes(), htd);
      admin.enableTable(table);
      fs.delete(status.getPath(), true);

      // fix OrphanTable with cache
      htd = admin.getTableDescriptor(table.getBytes()); // warms up cached htd on master
View Full Code Here

      public Object run() throws Exception {
        HBaseAdmin admin = new HBaseAdmin(conf);
        HTableDescriptor htd = new HTableDescriptor("testModifyTable_idx");
        htd.addFamily(new HColumnDescriptor("d"));
        htd.addFamily(new HColumnDescriptor("d1"));
        admin.modifyTable(Bytes.toBytes("testModifyTable_idx"), htd);
        return null;
      }
    };

    PrivilegedExceptionAction modifyMainTable = new PrivilegedExceptionAction() {
View Full Code Here

        IndexSpecification iSpec1 = new IndexSpecification("spec1");
        iSpec.addIndexColumn(hcd, "q", ValueType.String, 10);
        iSpec1.addIndexColumn(hcd1, "q", ValueType.String, 10);
        ihtd.addIndex(iSpec);
        ihtd.addIndex(iSpec1);
        admin.modifyTable(Bytes.toBytes("testModifyTable"), ihtd);
        return null;
      }
    };

    try {
View Full Code Here

    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"));
    while (regionsOfTable.size() != 1) {
      regionsOfTable =
View Full Code Here

      // disable the table
      hbaseAdmin.disableTable(userTable);

      // This will create the index table. Also modifies the existing table htable descriptor.
      hbaseAdmin.modifyTable(Bytes.toBytes(userTable), ihtd);
      boolean found = false;
      while (!found) {
        try {
          hbaseAdmin.getTableDescriptor(Bytes.toBytes(IndexUtils.getIndexTableName(userTable)));
        } catch (TableNotFoundException tnfe) {
View Full Code Here

                     * policy class cannot be found on the server, the HBase table is left in a horrible
                     * "ghost" state where it can't be used and can't be deleted without bouncing the master.
                     */
                    newDesc.setValue(HTableDescriptor.SPLIT_POLICY, MetaDataSplitPolicy.class.getName());
                    admin.disableTable(tableName);
                    admin.modifyTable(tableName, newDesc);
                    admin.enableTable(tableName);
                }
                return true;
            } else {
                if (existingDesc.equals(newDesc)) {
View Full Code Here

               
                // Update metadata of table
                // TODO: Take advantage of online schema change ability by setting "hbase.online.schema.update.enable" to true
                admin.disableTable(tableName);
                // TODO: What if not all existing column families are present?
                admin.modifyTable(tableName, newDesc);
                admin.enableTable(tableName);
               
                if (updateTo2_2) {
                    checkClientServerCompatibility();
                    upgradeTo2_2(admin);
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.