use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.CreateTableResponse in project hbase by apache.
the class HBaseAdmin method createTableAsync.
@Override
public Future<Void> createTableAsync(final HTableDescriptor desc, final byte[][] splitKeys) throws IOException {
if (desc.getTableName() == null) {
throw new IllegalArgumentException("TableName cannot be null");
}
if (splitKeys != null && splitKeys.length > 0) {
Arrays.sort(splitKeys, Bytes.BYTES_COMPARATOR);
// Verify there are no duplicate split keys
byte[] lastKey = null;
for (byte[] splitKey : splitKeys) {
if (Bytes.compareTo(splitKey, HConstants.EMPTY_BYTE_ARRAY) == 0) {
throw new IllegalArgumentException("Empty split key must not be passed in the split keys.");
}
if (lastKey != null && Bytes.equals(splitKey, lastKey)) {
throw new IllegalArgumentException("All split keys must be unique, " + "found duplicate: " + Bytes.toStringBinary(splitKey) + ", " + Bytes.toStringBinary(lastKey));
}
lastKey = splitKey;
}
}
CreateTableResponse response = executeCallable(new MasterCallable<CreateTableResponse>(getConnection(), getRpcControllerFactory()) {
@Override
protected CreateTableResponse rpcCall() throws Exception {
setPriority(desc.getTableName());
CreateTableRequest request = RequestConverter.buildCreateTableRequest(desc, splitKeys, ng.getNonceGroup(), ng.newNonce());
return master.createTable(getRpcController(), request);
}
});
return new CreateTableFuture(this, desc, splitKeys, response);
}
Aggregations