Package org.apache.hadoop.hbase.client

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


    public Map<String, byte[]> getDefaultTimestampReusingTables() {
        Map<String, byte[]> defaultTables = Maps.newHashMap(DEFAULT_TIMESTAMP_REUSING_TABLES);
        try {
            HBaseAdmin hbaseAdmin = new HBaseAdmin(conf);
            HTableDescriptor[] descriptors = hbaseAdmin.listTables();
            hbaseAdmin.close();
            if (descriptors != null) {
                for (HTableDescriptor descriptor : descriptors) {
                    if (LilyHBaseSchema.isRecordTableDescriptor(descriptor)) {
                        defaultTables.put(descriptor.getNameAsString(), Bytes.toBytes("data"));
View Full Code Here


        StringBuilder truncateReport = new StringBuilder();
        StringBuilder retainReport = new StringBuilder();

        HBaseAdmin admin = new HBaseAdmin(conf);
        try {
            HTableDescriptor[] tables = admin.listTables();
            System.out.println("Found tables: " + (tables == null ? "null" : tables.length));
            tables = tables == null ? new HTableDescriptor[0] : tables;

            Set<String> exploitTimestampTables = new HashSet<String>();
View Full Code Here

     * Disable and drop all the tables except SYSTEM.CATALOG and SYSTEM.SEQUENCE
     */
    protected static void disableAndDropNonSystemTables(PhoenixTestDriver driver) throws Exception {
        HBaseAdmin admin = driver.getConnectionQueryServices(null, null).getAdmin();
        try {
            HTableDescriptor[] tables = admin.listTables();
            for (HTableDescriptor table : tables) {
                boolean isCatalogTable = (Bytes.compareTo(table.getName(), PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES) == 0);
                boolean isSequenceTable = (Bytes.compareTo(table.getName(), PhoenixDatabaseMetaData.SEQUENCE_TABLE_NAME_BYTES) == 0);
                if (!isCatalogTable && !isSequenceTable) {
                    admin.disableTable(table.getName());
View Full Code Here

    final String HBASE_TABLE_NAME = "HiveExternalTable";
    HTableDescriptor htableDesc = new HTableDescriptor(HBASE_TABLE_NAME.getBytes());
    HColumnDescriptor hcolDesc = new HColumnDescriptor("cf".getBytes());
    htableDesc.addFamily(hcolDesc);
    HBaseAdmin hbaseAdmin = new HBaseAdmin(hbaseConf);
    if(Arrays.asList(hbaseAdmin.listTables()).contains(htableDesc)){
      // if table is already in there, don't recreate.
      return;
    }
    hbaseAdmin.createTable(htableDesc);
    HTable htable = new HTable(hbaseConf, HBASE_TABLE_NAME);
View Full Code Here

    AccessTestAction listTablesAction = new AccessTestAction() {
      @Override
      public Object run() throws Exception {
        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
        try {
          admin.listTables();
        } finally {
          admin.close();
        }
        return null;
      }
View Full Code Here

    final HBaseAdmin hbaseAdmin =
        HBaseFactory.Provider.get().getHBaseAdminFactory(hbaseURI).create(conf);

    try {
      final Set<String> instanceNames = Sets.newTreeSet();
      for (HTableDescriptor hTableDescriptor : hbaseAdmin.listTables()) {
        final String instanceName = parseInstanceName(hTableDescriptor.getNameAsString());
        if (null != instanceName) {
          instanceNames.add(instanceName);
        }
      }
View Full Code Here

    // name "GenericEndpoint" because "C" is before "G" lexicographically.

    HBaseAdmin admin = new HBaseAdmin(this.conf);

    // disable all user tables, if any are loaded.
    for (HTableDescriptor htd: admin.listTables()) {
      if (!htd.isMetaTable()) {
        String tableName = htd.getNameAsString();
        if (admin.isTableEnabled(tableName)) {
          try {
            admin.disableTable(htd.getNameAsString());
View Full Code Here

   * Truncates all tables
   * @throws Exception
   */
  public void truncateAllTables() throws Exception {
    HBaseAdmin admin = htu.getHBaseAdmin();
    for(HTableDescriptor table:admin.listTables()) {
      htu.truncateTable(table.getName());
    }
  }
 
 
View Full Code Here

   * Delete all tables
   * @throws Exception
   */
  public void deleteAllTables() throws Exception {
    HBaseAdmin admin = htu.getHBaseAdmin();
    for(HTableDescriptor table:admin.listTables()) {
      admin.disableTable(table.getName());
      admin.deleteTable(table.getName());
    }
  }

View Full Code Here

      BlockingInterface protocol =
          AccessControlProtos.AccessControlService.newBlockingStub(service);
      HTableDescriptor[] htds = null;
     
      if (tableRegex != null) {
        htds = ha.listTables(Pattern.compile(tableRegex));
        for (HTableDescriptor hd: htds) {
          permList.addAll(ProtobufUtil.getUserPermissions(protocol, hd.getTableName()));
        }
      } else {
        permList = ProtobufUtil.getUserPermissions(protocol);
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.