@Override public HTableDescriptor getHTableDescriptor(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableDescriptor(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public List<HRegionInfo> getTableRegions(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableRegions(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTableDescriptor getHTableDescriptor(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableDescriptor(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public List<HRegionInfo> getTableRegions(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableRegions(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public List<HRegionInfo> getTableRegions(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableRegions(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTableDescriptor getHTableDescriptor(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableDescriptor(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public List<HRegionInfo> getTableRegions(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableRegions(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTableDescriptor getHTableDescriptor(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.getTableDescriptor(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTable createHTable(Configuration conf, TableId tableId) throws IOException { Preconditions.checkArgument(tableId != null, "Table id should not be null"); return new HTable(conf, HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTableDescriptorBuilder buildHTableDescriptor(TableId tableId) { Preconditions.checkArgument(tableId != null, "Table id should not be null"); return new HBase11HTableDescriptorBuilder(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTableDescriptorBuilder buildHTableDescriptor(TableId tableId) { Preconditions.checkArgument(tableId != null, "Table id should not be null"); return new HBase10HTableDescriptorBuilder(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTable createHTable(Configuration conf, TableId tableId) throws IOException { Preconditions.checkArgument(tableId != null, "Table id should not be null"); return new HTable(conf, HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTable createHTable(Configuration conf, TableId tableId) throws IOException { Preconditions.checkArgument(tableId != null, "Table id should not be null"); return new HTable(conf, HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public boolean tableExists(HBaseAdmin admin, TableId tableId) throws IOException { Preconditions.checkArgument(admin != null, "HBaseAdmin should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); return admin.tableExists(HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public HTable createHTable(Configuration conf, TableId tableId) throws IOException { Preconditions.checkArgument(tableId != null, "Table id should not be null"); return new HTable(conf, HTableNameConverter.toTableName(tablePrefix, tableId)); }
@Override public void deleteTable(HBaseDDLExecutor ddlExecutor, TableId tableId) throws IOException { Preconditions.checkArgument(ddlExecutor != null, "HBaseDDLExecutor should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); TableName tableName = HTableNameConverter.toTableName(tablePrefix, tableId); ddlExecutor.deleteTableIfExists(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); }
@Override public void deleteTable(HBaseDDLExecutor ddlExecutor, TableId tableId) throws IOException { Preconditions.checkArgument(ddlExecutor != null, "HBaseDDLExecutor should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); TableName tableName = HTableNameConverter.toTableName(tablePrefix, tableId); ddlExecutor.deleteTableIfExists(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); }
private void enableTable(HBaseDDLExecutor ddlExecutor, TableId tableId) throws IOException { try { TableName tableName = HTableNameConverter.toTableName(cConf.get(Constants.Dataset.TABLE_PREFIX), tableId); ddlExecutor.enableTableIfDisabled(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); LOG.debug("TMS Table {} has been enabled.", tableName); } catch (TableNotFoundException ex) { LOG.debug("TMS Table {} was not found. Skipping enable.", tableId, ex); } catch (TableNotDisabledException ex) { LOG.debug("TMS Table {} was already in enabled state.", tableId, ex); } }
private void disable(String namespace, String tableName) throws IOException { HBaseTableUtil tableUtil = getTableUtil(); TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName); TableName name = HTableNameConverter.toTableName(getPrefix(), hTableId); ddlExecutor.disableTableIfEnabled(name.getNamespaceAsString(), name.getQualifierAsString()); }
@Test public void testHTableDescriptor() throws IOException { HBaseTableUtil tableUtil = getTableUtil(); TableId tableId = TableId.from("default", "test.dataset"); create(tableId); HTableDescriptor tableDescriptor = tableUtil.getHTableDescriptor(hAdmin, tableId); Assert.assertEquals(ProjectInfo.getVersion().toString(), tableDescriptor.getValue(HBaseTableUtil.CDAP_VERSION)); Assert.assertEquals(getPrefix(), tableDescriptor.getValue(Constants.Dataset.TABLE_PREFIX)); TableName tableName = HTableNameConverter.toTableName(getPrefix(), tableId); ddlExecutor.disableTableIfEnabled(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); tableUtil.deleteTable(ddlExecutor, tableId); }