use of org.apache.hadoop.hbase.client.TableDescriptorBuilder in project hbase by apache.
the class StripeCompactionsPerformanceEvaluation method createHtd.
private TableDescriptorBuilder createHtd(boolean isStripe) throws Exception {
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(TABLE_NAME).setColumnFamily(ColumnFamilyDescriptorBuilder.of(COLUMN_FAMILY));
String noSplitsPolicy = DisabledRegionSplitPolicy.class.getName();
builder.setValue(HConstants.HBASE_REGION_SPLIT_POLICY_KEY, noSplitsPolicy);
if (isStripe) {
builder.setValue(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName());
if (initialStripeCount != null) {
builder.setValue(StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialStripeCount.toString());
builder.setValue(HStore.BLOCKING_STOREFILES_KEY, Long.toString(10 * initialStripeCount));
} else {
builder.setValue(HStore.BLOCKING_STOREFILES_KEY, "500");
}
if (splitSize != null) {
builder.setValue(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize.toString());
}
if (splitParts != null) {
builder.setValue(StripeStoreConfig.SPLIT_PARTS_KEY, splitParts.toString());
}
} else {
// default
builder.setValue(HStore.BLOCKING_STOREFILES_KEY, "10");
}
return builder;
}
use of org.apache.hadoop.hbase.client.TableDescriptorBuilder in project hbase by apache.
the class Action method modifyAllTableColumns.
/**
* Apply a transform to all columns in a given table. If there are no columns in a table
* or if the context is stopping does nothing.
* @param tableName the table to modify
* @param transform the modification to perform. Callers will have the
* column name as a string and a column family builder available to them
*/
protected void modifyAllTableColumns(TableName tableName, BiConsumer<String, ColumnFamilyDescriptorBuilder> transform) throws IOException {
HBaseTestingUtil util = this.context.getHBaseIntegrationTestingUtility();
Admin admin = util.getAdmin();
TableDescriptor tableDescriptor = admin.getDescriptor(tableName);
ColumnFamilyDescriptor[] columnDescriptors = tableDescriptor.getColumnFamilies();
if (columnDescriptors == null || columnDescriptors.length == 0) {
return;
}
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableDescriptor);
for (ColumnFamilyDescriptor descriptor : columnDescriptors) {
ColumnFamilyDescriptorBuilder cfd = ColumnFamilyDescriptorBuilder.newBuilder(descriptor);
transform.accept(descriptor.getNameAsString(), cfd);
builder.modifyColumnFamily(cfd.build());
}
// Don't try the modify if we're stopping
if (this.context.isStopping()) {
return;
}
admin.modifyTable(builder.build());
}
use of org.apache.hadoop.hbase.client.TableDescriptorBuilder in project hbase by apache.
the class ChangeSplitPolicyAction method perform.
@Override
public void perform() throws Exception {
HBaseTestingUtil util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getAdmin();
getLogger().info("Performing action: Change split policy of table " + tableName);
TableDescriptor tableDescriptor = admin.getDescriptor(tableName);
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableDescriptor);
String chosenPolicy = possiblePolicies[random.nextInt(possiblePolicies.length)];
builder.setRegionSplitPolicyClassName(chosenPolicy);
getLogger().info("Changing " + tableName + " split policy to " + chosenPolicy);
admin.modifyTable(builder.build());
}
use of org.apache.hadoop.hbase.client.TableDescriptorBuilder in project hbase by apache.
the class TestChangeSplitPolicyAction method setUp.
@Before
public void setUp() throws Exception {
Admin admin = TEST_UTIL.getAdmin();
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName);
admin.createTable(builder.setColumnFamily(ColumnFamilyDescriptorBuilder.of("fam")).build());
}
use of org.apache.hadoop.hbase.client.TableDescriptorBuilder in project hbase by apache.
the class TestHFileOutputFormat2 method setupMockColumnFamiliesForDataBlockEncoding.
private void setupMockColumnFamiliesForDataBlockEncoding(Table table, Map<String, DataBlockEncoding> familyToDataBlockEncoding) throws IOException {
TableDescriptorBuilder mockTableDescriptor = TableDescriptorBuilder.newBuilder(TABLE_NAMES[0]);
for (Entry<String, DataBlockEncoding> entry : familyToDataBlockEncoding.entrySet()) {
ColumnFamilyDescriptor columnFamilyDescriptor = ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(entry.getKey())).setMaxVersions(1).setDataBlockEncoding(entry.getValue()).setBlockCacheEnabled(false).setTimeToLive(0).build();
mockTableDescriptor.setColumnFamily(columnFamilyDescriptor);
}
Mockito.doReturn(mockTableDescriptor).when(table).getDescriptor();
}
Aggregations