Search in sources :

Example 1 with CreateTableResponse

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);
}
Also used : CreateTableResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.CreateTableResponse) CreateTableRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.CreateTableRequest) RestoreSnapshotException(org.apache.hadoop.hbase.snapshot.RestoreSnapshotException) SnapshotCreationException(org.apache.hadoop.hbase.snapshot.SnapshotCreationException) InterruptedIOException(java.io.InterruptedIOException) ZooKeeperConnectionException(org.apache.hadoop.hbase.ZooKeeperConnectionException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) TableNotDisabledException(org.apache.hadoop.hbase.TableNotDisabledException) TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) HBaseSnapshotException(org.apache.hadoop.hbase.snapshot.HBaseSnapshotException) TimeoutException(java.util.concurrent.TimeoutException) NotServingRegionException(org.apache.hadoop.hbase.NotServingRegionException) ReplicationException(org.apache.hadoop.hbase.replication.ReplicationException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) UnknownRegionException(org.apache.hadoop.hbase.UnknownRegionException) FailedLogCloseException(org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException) MasterNotRunningException(org.apache.hadoop.hbase.MasterNotRunningException) TimeoutIOException(org.apache.hadoop.hbase.exceptions.TimeoutIOException) NamespaceNotFoundException(org.apache.hadoop.hbase.NamespaceNotFoundException) TableExistsException(org.apache.hadoop.hbase.TableExistsException) KeeperException(org.apache.zookeeper.KeeperException) UnknownSnapshotException(org.apache.hadoop.hbase.snapshot.UnknownSnapshotException) RemoteException(org.apache.hadoop.ipc.RemoteException) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)

Aggregations

IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 MasterNotRunningException (org.apache.hadoop.hbase.MasterNotRunningException)1 NamespaceNotFoundException (org.apache.hadoop.hbase.NamespaceNotFoundException)1 NotServingRegionException (org.apache.hadoop.hbase.NotServingRegionException)1 TableExistsException (org.apache.hadoop.hbase.TableExistsException)1 TableNotDisabledException (org.apache.hadoop.hbase.TableNotDisabledException)1 TableNotFoundException (org.apache.hadoop.hbase.TableNotFoundException)1 UnknownRegionException (org.apache.hadoop.hbase.UnknownRegionException)1 ZooKeeperConnectionException (org.apache.hadoop.hbase.ZooKeeperConnectionException)1 TimeoutIOException (org.apache.hadoop.hbase.exceptions.TimeoutIOException)1 FailedLogCloseException (org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException)1 ReplicationException (org.apache.hadoop.hbase.replication.ReplicationException)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 CreateTableRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.CreateTableRequest)1 CreateTableResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.CreateTableResponse)1 HBaseSnapshotException (org.apache.hadoop.hbase.snapshot.HBaseSnapshotException)1