use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class ThriftHBaseServiceHandler method modifyColumnFamily.
@Override
public void modifyColumnFamily(TTableName tableName, TColumnFamilyDescriptor column) throws TIOError, TException {
try {
TableName table = tableNameFromThrift(tableName);
ColumnFamilyDescriptor columnFamilyDescriptor = columnFamilyDescriptorFromThrift(column);
connectionCache.getAdmin().modifyColumnFamily(table, columnFamilyDescriptor);
} catch (IOException e) {
throw getTIOError(e);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class ThriftUtilities method tableNameFromHBase.
public static TTableName tableNameFromHBase(TableName table) {
TTableName tableName = new TTableName();
tableName.setNs(table.getNamespace());
tableName.setQualifier(table.getQualifier());
return tableName;
}
use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class TestThriftHBaseServiceHandler method testExceptionType.
private void testExceptionType(THBaseService.Iface handler, ThriftMetrics metrics, ByteBuffer tTableName, byte[] rowkey, ErrorThrowingGetObserver.ErrorType errorType) {
long preGetCounter = metricsHelper.getCounter("get_num_ops", metrics.getSource());
String exceptionKey = errorType.getMetricName();
long preExceptionCounter = metricsHelper.checkCounterExists(exceptionKey, metrics.getSource()) ? metricsHelper.getCounter(exceptionKey, metrics.getSource()) : 0;
TGet tGet = new TGet(wrap(rowkey));
Map<ByteBuffer, ByteBuffer> attributes = new HashMap<>();
attributes.put(wrap(Bytes.toBytes(ErrorThrowingGetObserver.SHOULD_ERROR_ATTRIBUTE)), wrap(Bytes.toBytes(errorType.name())));
tGet.setAttributes(attributes);
try {
TResult tResult = handler.get(tTableName, tGet);
fail("Get with error attribute should have thrown an exception");
} catch (TException e) {
LOG.info("Received exception: ", e);
metricsHelper.assertCounter("get_num_ops", preGetCounter + 1, metrics.getSource());
metricsHelper.assertCounter(exceptionKey, preExceptionCounter + 1, metrics.getSource());
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class ThriftHBaseServiceHandler method deleteColumnFamily.
@Override
public void deleteColumnFamily(TTableName tableName, ByteBuffer column) throws TIOError, TException {
try {
TableName table = tableNameFromThrift(tableName);
connectionCache.getAdmin().deleteColumnFamily(table, column.array());
} catch (IOException e) {
throw getTIOError(e);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class ThriftHBaseServiceHandler method truncateTable.
@Override
public void truncateTable(TTableName tableName, boolean preserveSplits) throws TIOError, TException {
try {
TableName table = tableNameFromThrift(tableName);
connectionCache.getAdmin().truncateTable(table, preserveSplits);
} catch (IOException e) {
throw getTIOError(e);
}
}
Aggregations