Search in sources :

Example 26 with NamespaceDescriptor

use of org.apache.hadoop.hbase.NamespaceDescriptor in project hbase by apache.

the class ThriftUtilities method namespaceDescriptorsFromThrift.

public static NamespaceDescriptor[] namespaceDescriptorsFromThrift(List<TNamespaceDescriptor> in) {
    NamespaceDescriptor[] out = new NamespaceDescriptor[in.size()];
    int index = 0;
    for (TNamespaceDescriptor descriptor : in) {
        out[index++] = namespaceDescriptorFromThrift(descriptor);
    }
    return out;
}
Also used : TNamespaceDescriptor(org.apache.hadoop.hbase.thrift2.generated.TNamespaceDescriptor) NamespaceDescriptor(org.apache.hadoop.hbase.NamespaceDescriptor) TNamespaceDescriptor(org.apache.hadoop.hbase.thrift2.generated.TNamespaceDescriptor)

Example 27 with NamespaceDescriptor

use of org.apache.hadoop.hbase.NamespaceDescriptor in project hbase by apache.

the class ThriftHBaseServiceHandler method modifyNamespace.

@Override
public void modifyNamespace(TNamespaceDescriptor namespaceDesc) throws TIOError, TException {
    try {
        NamespaceDescriptor descriptor = namespaceDescriptorFromThrift(namespaceDesc);
        connectionCache.getAdmin().modifyNamespace(descriptor);
    } catch (IOException e) {
        throw getTIOError(e);
    }
}
Also used : TNamespaceDescriptor(org.apache.hadoop.hbase.thrift2.generated.TNamespaceDescriptor) NamespaceDescriptor(org.apache.hadoop.hbase.NamespaceDescriptor) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) IOException(java.io.IOException)

Example 28 with NamespaceDescriptor

use of org.apache.hadoop.hbase.NamespaceDescriptor in project hbase by apache.

the class TestSimpleRegionNormalizerOnCluster method buildTableNameForQuotaTest.

private static TableName buildTableNameForQuotaTest(final String methodName) throws Exception {
    String nsp = "np2";
    NamespaceDescriptor nspDesc = NamespaceDescriptor.create(nsp).addConfiguration(TableNamespaceManager.KEY_MAX_REGIONS, "5").addConfiguration(TableNamespaceManager.KEY_MAX_TABLES, "2").build();
    admin.createNamespace(nspDesc).get();
    return TableName.valueOf(nsp, methodName);
}
Also used : NamespaceDescriptor(org.apache.hadoop.hbase.NamespaceDescriptor)

Example 29 with NamespaceDescriptor

use of org.apache.hadoop.hbase.NamespaceDescriptor in project hbase by apache.

the class TestCreateNamespaceProcedure method validateNamespaceCreated.

private void validateNamespaceCreated(NamespaceDescriptor nsd) throws IOException {
    NamespaceDescriptor createdNsDescriptor = UTIL.getAdmin().getNamespaceDescriptor(nsd.getName());
    assertNotNull(createdNsDescriptor);
}
Also used : NamespaceDescriptor(org.apache.hadoop.hbase.NamespaceDescriptor)

Example 30 with NamespaceDescriptor

use of org.apache.hadoop.hbase.NamespaceDescriptor in project hbase by apache.

the class TestCreateNamespaceProcedure method testCreateNamespaceWithInvalidRegionCount.

@Test
public void testCreateNamespaceWithInvalidRegionCount() throws Exception {
    final NamespaceDescriptor nsd = NamespaceDescriptor.create("testCreateNamespaceWithInvalidRegionCount").build();
    final String nsKey = "hbase.namespace.quota.maxregions";
    final String nsValue = "-1";
    final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
    nsd.setConfiguration(nsKey, nsValue);
    long procId = procExec.submitProcedure(new CreateNamespaceProcedure(procExec.getEnvironment(), nsd));
    // Wait the completion
    ProcedureTestingUtility.waitProcedure(procExec, procId);
    Procedure<?> result = procExec.getResult(procId);
    assertTrue(result.isFailed());
    LOG.debug("Create namespace failed with exception: " + result.getException());
    assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof ConstraintException);
}
Also used : NamespaceDescriptor(org.apache.hadoop.hbase.NamespaceDescriptor) ConstraintException(org.apache.hadoop.hbase.constraint.ConstraintException) Test(org.junit.Test)

Aggregations

NamespaceDescriptor (org.apache.hadoop.hbase.NamespaceDescriptor)97 Test (org.junit.Test)51 TableName (org.apache.hadoop.hbase.TableName)26 IOException (java.io.IOException)17 Admin (org.apache.hadoop.hbase.client.Admin)15 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)13 ColumnFamilyDescriptor (org.apache.hadoop.hbase.client.ColumnFamilyDescriptor)11 TableDescriptorBuilder (org.apache.hadoop.hbase.client.TableDescriptorBuilder)11 QuotaExceededException (org.apache.hadoop.hbase.quotas.QuotaExceededException)9 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)8 Table (org.apache.hadoop.hbase.client.Table)8 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)7 NamespaceNotFoundException (org.apache.hadoop.hbase.NamespaceNotFoundException)7 Connection (org.apache.hadoop.hbase.client.Connection)7 ConstraintException (org.apache.hadoop.hbase.constraint.ConstraintException)7 RestoreSnapshotException (org.apache.hadoop.hbase.snapshot.RestoreSnapshotException)7 KeeperException (org.apache.zookeeper.KeeperException)7 ArrayList (java.util.ArrayList)6 ExecutionException (java.util.concurrent.ExecutionException)5 NamespaceExistException (org.apache.hadoop.hbase.NamespaceExistException)5