use of org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder in project hbase by apache.
the class ModifyColumnFamilyStoreFileTrackerProcedure method createMigrationTableDescriptor.
@Override
protected TableDescriptor createMigrationTableDescriptor(Configuration conf, TableDescriptor current) {
ColumnFamilyDescriptorBuilder builder = ColumnFamilyDescriptorBuilder.newBuilder(current.getColumnFamily(family));
migrate(conf, builder::setConfiguration);
return TableDescriptorBuilder.newBuilder(current).modifyColumnFamily(builder.build()).build();
}
use of org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder in project hbase by apache.
the class ModifyColumnFamilyStoreFileTrackerProcedure method createFinishTableDescriptor.
@Override
protected TableDescriptor createFinishTableDescriptor(TableDescriptor current) {
ColumnFamilyDescriptorBuilder builder = ColumnFamilyDescriptorBuilder.newBuilder(current.getColumnFamily(family));
finish(builder::setConfiguration, builder::removeConfiguration);
return TableDescriptorBuilder.newBuilder(current).modifyColumnFamily(builder.build()).build();
}
use of org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder in project hbase by apache.
the class TestRegionObserverInterface method testPreWALAppendNotCalledOnMetaEdit.
@Test
public void testPreWALAppendNotCalledOnMetaEdit() throws Exception {
final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
TableDescriptorBuilder tdBuilder = TableDescriptorBuilder.newBuilder(tableName);
ColumnFamilyDescriptorBuilder cfBuilder = ColumnFamilyDescriptorBuilder.newBuilder(FAMILY);
tdBuilder.setColumnFamily(cfBuilder.build());
tdBuilder.setCoprocessor(SimpleRegionObserver.class.getName());
TableDescriptor td = tdBuilder.build();
Table table = util.createTable(td, new byte[][] { A, B, C });
PreWALAppendWALActionsListener listener = new PreWALAppendWALActionsListener();
List<HRegion> regions = util.getHBaseCluster().getRegions(tableName);
// should be only one region
HRegion region = regions.get(0);
region.getWAL().registerWALActionsListener(listener);
// flushing should write to the WAL
region.flush(true);
// so should compaction
region.compact(false);
// and so should closing the region
region.close();
// but we still shouldn't have triggered preWALAppend because no user data was written
String[] methods = new String[] { "getCtPreWALAppend" };
Object[] expectedResult = new Integer[] { 0 };
verifyMethodResult(SimpleRegionObserver.class, methods, tableName, expectedResult);
}
use of org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder in project hbase by apache.
the class PerformanceEvaluation method getTableDescriptor.
/**
* Create an HTableDescriptor from provided TestOptions.
*/
protected static TableDescriptor getTableDescriptor(TestOptions opts) {
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(TableName.valueOf(opts.tableName));
for (int family = 0; family < opts.families; family++) {
byte[] familyName = Bytes.toBytes(FAMILY_NAME_BASE + family);
ColumnFamilyDescriptorBuilder cfBuilder = ColumnFamilyDescriptorBuilder.newBuilder(familyName);
cfBuilder.setDataBlockEncoding(opts.blockEncoding);
cfBuilder.setCompressionType(opts.compression);
cfBuilder.setBloomFilterType(opts.bloomType);
cfBuilder.setBlocksize(opts.blockSize);
if (opts.inMemoryCF) {
cfBuilder.setInMemory(true);
}
cfBuilder.setInMemoryCompaction(opts.inMemoryCompaction);
builder.setColumnFamily(cfBuilder.build());
}
if (opts.replicas != DEFAULT_OPTS.replicas) {
builder.setRegionReplication(opts.replicas);
}
if (opts.splitPolicy != null && !opts.splitPolicy.equals(DEFAULT_OPTS.splitPolicy)) {
builder.setRegionSplitPolicyClassName(opts.splitPolicy);
}
return builder.build();
}
use of org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder in project hbase by apache.
the class HBaseTestingUtil method createTableDescriptor.
public TableDescriptor createTableDescriptor(final TableName name, final int minVersions, final int versions, final int ttl, KeepDeletedCells keepDeleted) {
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(name);
for (byte[] cfName : new byte[][] { fam1, fam2, fam3 }) {
ColumnFamilyDescriptorBuilder cfBuilder = ColumnFamilyDescriptorBuilder.newBuilder(cfName).setMinVersions(minVersions).setMaxVersions(versions).setKeepDeletedCells(keepDeleted).setBlockCacheEnabled(false).setTimeToLive(ttl);
if (isNewVersionBehaviorEnabled()) {
cfBuilder.setNewVersionBehavior(true);
}
builder.setColumnFamily(cfBuilder.build());
}
return builder.build();
}
Aggregations