Java Code Examples for org.apache.hadoop.hbase.client.Admin#deleteNamespace()

The following examples show how to use org.apache.hadoop.hbase.client.Admin#deleteNamespace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestMasterQuotasObserver.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testNamespaceSpaceQuotaRemoved() throws Exception {
  final Connection conn = TEST_UTIL.getConnection();
  final Admin admin = conn.getAdmin();
  final String ns = testName.getMethodName();
  // Drop the ns if it somehow exists
  if (namespaceExists(ns)) {
    admin.deleteNamespace(ns);
  }

  // Create the ns
  NamespaceDescriptor desc = NamespaceDescriptor.create(ns).build();
  admin.createNamespace(desc);
  assertEquals(0, getNumSpaceQuotas());

  // Set a quota
  QuotaSettings settings = QuotaSettingsFactory.limitNamespaceSpace(
      ns, 1024L, SpaceViolationPolicy.NO_INSERTS);
  admin.setQuota(settings);
  assertEquals(1, getNumSpaceQuotas());

  // Delete the namespace and observe the quota being automatically deleted as well
  admin.deleteNamespace(ns);
  assertEquals(0, getNumSpaceQuotas());
}
 
Example 2
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeleteRow() throws IOException {
  Admin admin = TEST_UTIL.getAdmin();
  admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
  Table table
          = TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);

  table.put(new Put(HelloHBase.MY_ROW_ID).
          addColumn(HelloHBase.MY_COLUMN_FAMILY_NAME,
                  HelloHBase.MY_FIRST_COLUMN_QUALIFIER,
                  Bytes.toBytes("xyz")));
  HelloHBase.deleteRow(table);
  Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
  assertEquals("#deleteRow failed to delete row.", true, row.isEmpty());

  TEST_UTIL.deleteTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
}
 
Example 3
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateNamespaceAndTable() throws Exception {
  Admin admin = TEST_UTIL.getAdmin();
  HelloHBase.createNamespaceAndTable(admin);

  boolean namespaceExists
          = HelloHBase.namespaceExists(admin, HelloHBase.MY_NAMESPACE_NAME);
  assertEquals("#createNamespaceAndTable failed to create namespace.",
          true, namespaceExists);

  boolean tableExists = admin.tableExists(HelloHBase.MY_TABLE_NAME);
  assertEquals("#createNamespaceAndTable failed to create table.",
          true, tableExists);

  admin.disableTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
}
 
Example 4
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testNamespaceExists() throws Exception {
  final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent";
  final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace";
  boolean exists;
  Admin admin = TEST_UTIL.getAdmin();

  exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE);
  assertEquals("#namespaceExists failed: found nonexistent namespace.",
          false, exists);

  admin.createNamespace(NamespaceDescriptor.create(EXISTING_NAMESPACE).build());
  exists = HelloHBase.namespaceExists(admin, EXISTING_NAMESPACE);
  assertEquals("#namespaceExists failed: did NOT find existing namespace.",
          true, exists);
  admin.deleteNamespace(EXISTING_NAMESPACE);
}
 
Example 5
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeleteRow() throws IOException {
  Admin admin = TEST_UTIL.getAdmin();
  admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
  Table table
          = TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);

  table.put(new Put(HelloHBase.MY_ROW_ID).
          addColumn(HelloHBase.MY_COLUMN_FAMILY_NAME,
                  HelloHBase.MY_FIRST_COLUMN_QUALIFIER,
                  Bytes.toBytes("xyz")));
  HelloHBase.deleteRow(table);
  Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
  assertEquals("#deleteRow failed to delete row.", true, row.isEmpty());

  TEST_UTIL.deleteTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
}
 
Example 6
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateNamespaceAndTable() throws Exception {
  Admin admin = TEST_UTIL.getAdmin();
  HelloHBase.createNamespaceAndTable(admin);

  boolean namespaceExists
          = HelloHBase.namespaceExists(admin, HelloHBase.MY_NAMESPACE_NAME);
  assertEquals("#createNamespaceAndTable failed to create namespace.",
          true, namespaceExists);

  boolean tableExists = admin.tableExists(HelloHBase.MY_TABLE_NAME);
  assertEquals("#createNamespaceAndTable failed to create table.",
          true, tableExists);

  admin.disableTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
}
 
Example 7
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testNamespaceExists() throws Exception {
  final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent";
  final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace";
  boolean exists;
  Admin admin = TEST_UTIL.getAdmin();

  exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE);
  assertEquals("#namespaceExists failed: found nonexistent namespace.",
          false, exists);

  admin.createNamespace(NamespaceDescriptor.create(EXISTING_NAMESPACE).build());
  exists = HelloHBase.namespaceExists(admin, EXISTING_NAMESPACE);
  assertEquals("#namespaceExists failed: did NOT find existing namespace.",
          true, exists);
  admin.deleteNamespace(EXISTING_NAMESPACE);
}
 
Example 8
Source File: IntegrationTestDDLMasterFailover.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
public void cleanUpCluster() throws Exception {
  if (!keepObjectsAtTheEnd) {
    Admin admin = util.getAdmin();
    for (TableName tableName: admin.listTableNames(Pattern.compile("ittable-\\d+"))) {
      admin.disableTable(tableName);
      admin.deleteTable(tableName);
    }
    NamespaceDescriptor [] nsds = admin.listNamespaceDescriptors();
    for(NamespaceDescriptor nsd: nsds) {
      if(nsd.getName().matches("itnamespace\\d+")) {
        LOG.info("Removing namespace="+nsd.getName());
        admin.deleteNamespace(nsd.getName());
      }
    }
  }

  enabledTables.clear();
  disabledTables.clear();
  deletedTables.clear();
  namespaceMap.clear();

  Connection connection = getConnection();
  connection.close();
  super.cleanUpCluster();
}
 
Example 9
Source File: TestMasterQuotasObserver.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testNamespaceRPCQuotaRemoved() throws Exception {
  final Connection conn = TEST_UTIL.getConnection();
  final Admin admin = conn.getAdmin();
  final String ns = testName.getMethodName();
  // Drop the ns if it somehow exists
  if (namespaceExists(ns)) {
    admin.deleteNamespace(ns);
  }

  // Create the ns
  NamespaceDescriptor desc = NamespaceDescriptor.create(ns).build();
  admin.createNamespace(desc);
  assertEquals(0, getThrottleQuotas());

  // Set a quota
  QuotaSettings settings =
      QuotaSettingsFactory.throttleNamespace(ns, ThrottleType.REQUEST_SIZE, 2L, TimeUnit.HOURS);
  admin.setQuota(settings);
  assertEquals(1, getThrottleQuotas());

  // Delete the namespace and observe the quota being automatically deleted as well
  admin.deleteNamespace(ns);
  assertEquals(0, getThrottleQuotas());
}
 
Example 10
Source File: NamespacesInstanceResource.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Build a response for DELETE delete namespace.
 * @param message value not used.
 * @param headers value not used.
 * @return response code.
 */
@DELETE
public Response deleteNoBody(final byte[] message,
    final @Context UriInfo uriInfo, final @Context HttpHeaders headers) {
  if (LOG.isTraceEnabled()) {
    LOG.trace("DELETE " + uriInfo.getAbsolutePath());
  }
  if (servlet.isReadOnly()) {
    servlet.getMetrics().incrementFailedDeleteRequests(1);
    return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT)
        .entity("Forbidden" + CRLF).build();
  }

  try{
    Admin admin = servlet.getAdmin();
    if (!doesNamespaceExist(admin, namespace)){
      return Response.status(Response.Status.NOT_FOUND).type(MIMETYPE_TEXT).
          entity("Namespace '" + namespace + "' does not exists.  Cannot " +
          "drop namespace.").build();
    }

    admin.deleteNamespace(namespace);
    servlet.getMetrics().incrementSucessfulDeleteRequests(1);
    return Response.ok().build();

  } catch (IOException e) {
    servlet.getMetrics().incrementFailedDeleteRequests(1);
    return processException(e);
  }
}
 
Example 11
Source File: HelloHBase.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Invokes Admin#disableTable, Admin#deleteTable, and Admin#deleteNamespace to
 * disable/delete Table and delete Namespace.
 *
 * @param admin Standard Admin object
 * @throws IOException If IO problem is encountered
 */
static void deleteNamespaceAndTable(final Admin admin) throws IOException {
  if (admin.tableExists(MY_TABLE_NAME)) {
    System.out.println("Disabling/deleting Table ["
            + MY_TABLE_NAME.getNameAsString() + "].");
    admin.disableTable(MY_TABLE_NAME); // Disable a table before deleting it.
    admin.deleteTable(MY_TABLE_NAME);
  }
  if (namespaceExists(admin, MY_NAMESPACE_NAME)) {
    System.out.println("Deleting Namespace [" + MY_NAMESPACE_NAME + "].");
    admin.deleteNamespace(MY_NAMESPACE_NAME);
  }
}
 
Example 12
Source File: IntegrationTestDDLMasterFailover.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
void perform() throws IOException {
  NamespaceDescriptor selected = selectNamespace(namespaceMap);
  if (selected == null) {
    return;
  }

  Admin admin = connection.getAdmin();
  try {
    String namespaceName = selected.getName();
    LOG.info("Deleting namespace :" + selected);
    admin.deleteNamespace(namespaceName);
    try {
      if (admin.getNamespaceDescriptor(namespaceName) != null) {
        // the namespace still exists.
        Assert.assertTrue("Namespace: " + selected + " was not deleted", false);
      } else {
        LOG.info("Deleted namespace :" + selected);
      }
    } catch (NamespaceNotFoundException nsnfe) {
      // This is expected result
      LOG.info("Deleted namespace :" + selected);
    }
  } catch (Exception e){
    LOG.warn("Caught exception in action: " + this.getClass());
    throw e;
  } finally {
    admin.close();
  }
}
 
Example 13
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutRowToTable() throws IOException {
  Admin admin = TEST_UTIL.getAdmin();
  admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
  Table table
          = TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);

  HelloHBase.putRowToTable(table);
  Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
  assertEquals("#putRowToTable failed to store row.", false, row.isEmpty());

  TEST_UTIL.deleteTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
}
 
Example 14
Source File: TestMasterObserverPostCalls.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testPostDeleteNamespace() throws IOException {
  final Admin admin = UTIL.getAdmin();
  final String ns = "postdeletens";
  final TableName tn1 = TableName.valueOf(ns, "table1");

  admin.createNamespace(NamespaceDescriptor.create(ns).build());
  admin.createTable(TableDescriptorBuilder.newBuilder(tn1)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes("f1")).build())
      .build());

  HMaster master = UTIL.getMiniHBaseCluster().getMaster();
  MasterObserverForTest observer = master.getMasterCoprocessorHost().findCoprocessor(
      MasterObserverForTest.class);
  int preCount = observer.postHookCalls.get();
  try {
    admin.deleteNamespace(ns);
    fail("Deleting a non-empty namespace should be disallowed");
  } catch (IOException e) {
    // Pass
  }
  int postCount = observer.postHookCalls.get();
  assertEquals("Expected no invocations of postDeleteNamespace when the operation fails",
      preCount, postCount);

  // Disable and delete the table so that we can delete the NS.
  admin.disableTable(tn1);
  admin.deleteTable(tn1);

  // Validate that the postDeletNS hook is invoked
  preCount = observer.postHookCalls.get();
  admin.deleteNamespace(ns);
  postCount = observer.postHookCalls.get();
  assertEquals("Expected 1 invocation of postDeleteNamespace", preCount + 1, postCount);
}
 
Example 15
Source File: HelloHBase.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Invokes Admin#disableTable, Admin#deleteTable, and Admin#deleteNamespace to
 * disable/delete Table and delete Namespace.
 *
 * @param admin Standard Admin object
 * @throws IOException If IO problem is encountered
 */
static void deleteNamespaceAndTable(final Admin admin) throws IOException {
  if (admin.tableExists(MY_TABLE_NAME)) {
    System.out.println("Disabling/deleting Table ["
            + MY_TABLE_NAME.getNameAsString() + "].");
    admin.disableTable(MY_TABLE_NAME); // Disable a table before deleting it.
    admin.deleteTable(MY_TABLE_NAME);
  }
  if (namespaceExists(admin, MY_NAMESPACE_NAME)) {
    System.out.println("Deleting Namespace [" + MY_NAMESPACE_NAME + "].");
    admin.deleteNamespace(MY_NAMESPACE_NAME);
  }
}
 
Example 16
Source File: TestHelloHBase.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutRowToTable() throws IOException {
  Admin admin = TEST_UTIL.getAdmin();
  admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
  Table table
          = TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);

  HelloHBase.putRowToTable(table);
  Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
  assertEquals("#putRowToTable failed to store row.", false, row.isEmpty());

  TEST_UTIL.deleteTable(HelloHBase.MY_TABLE_NAME);
  admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
}
 
Example 17
Source File: TestNamespacesResource.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testNamespaceListXMLandJSON() throws IOException, JAXBException {
  String namespacePath = "/namespaces/";
  NamespacesModel model;
  Response response;

  // Check that namespace does not yet exist via non-REST call.
  Admin admin = TEST_UTIL.getAdmin();
  assertFalse(doesNamespaceExist(admin, NAMESPACE1));
  model = testNamespacesModel.buildTestModel();
  testNamespacesModel.checkModel(model);

  // Check that REST GET finds only default namespaces via XML and JSON responses.
  response = client.get(namespacePath, Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  model = fromXML(response.getBody());
  testNamespacesModel.checkModel(model, "hbase", "default");
  response = client.get(namespacePath, Constants.MIMETYPE_JSON);
  assertEquals(200, response.getCode());
  model = testNamespacesModel.fromJSON(Bytes.toString(response.getBody()));
  testNamespacesModel.checkModel(model, "hbase", "default");

  // Create namespace and check that REST GET finds one additional namespace.
  createNamespaceViaAdmin(admin, NAMESPACE1);
  response = client.get(namespacePath, Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  model = fromXML(response.getBody());
  testNamespacesModel.checkModel(model, NAMESPACE1, "hbase", "default");
  response = client.get(namespacePath, Constants.MIMETYPE_JSON);
  assertEquals(200, response.getCode());
  model = testNamespacesModel.fromJSON(Bytes.toString(response.getBody()));
  testNamespacesModel.checkModel(model, NAMESPACE1, "hbase", "default");

  // Create another namespace and check that REST GET finds one additional namespace.
  createNamespaceViaAdmin(admin, NAMESPACE2);
  response = client.get(namespacePath, Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  model = fromXML(response.getBody());
  testNamespacesModel.checkModel(model, NAMESPACE1, NAMESPACE2, "hbase", "default");
  response = client.get(namespacePath, Constants.MIMETYPE_JSON);
  assertEquals(200, response.getCode());
  model = testNamespacesModel.fromJSON(Bytes.toString(response.getBody()));
  testNamespacesModel.checkModel(model, NAMESPACE1, NAMESPACE2, "hbase", "default");

  // Delete namespace and check that REST still finds correct namespaces.
  admin.deleteNamespace(NAMESPACE1);
  response = client.get(namespacePath, Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  model = fromXML(response.getBody());
  testNamespacesModel.checkModel(model, NAMESPACE2, "hbase", "default");
  response = client.get(namespacePath, Constants.MIMETYPE_JSON);
  assertEquals(200, response.getCode());
  model = testNamespacesModel.fromJSON(Bytes.toString(response.getBody()));
  testNamespacesModel.checkModel(model, NAMESPACE2, "hbase", "default");

  admin.deleteNamespace(NAMESPACE2);
}
 
Example 18
Source File: TestNamespacesResource.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testNamespaceListPBandDefault() throws IOException {
  String schemaPath = "/namespaces/";
  NamespacesModel model;
  Response response;

  // Check that namespace does not yet exist via non-REST call.
  Admin admin = TEST_UTIL.getAdmin();
  assertFalse(doesNamespaceExist(admin, NAMESPACE1));
  model = testNamespacesModel.buildTestModel();
  testNamespacesModel.checkModel(model);

  // Check that REST GET finds only default namespaces via PB and default Accept header.
  response = client.get(schemaPath, Constants.MIMETYPE_PROTOBUF);
  assertEquals(200, response.getCode());
  model.getObjectFromMessage(response.getBody());
  testNamespacesModel.checkModel(model, "hbase", "default");
  response = client.get(schemaPath);
  assertEquals(200, response.getCode());

  // Create namespace and check that REST GET finds one additional namespace.
  createNamespaceViaAdmin(admin, NAMESPACE1);
  response = client.get(schemaPath, Constants.MIMETYPE_PROTOBUF);
  assertEquals(200, response.getCode());
  model.getObjectFromMessage(response.getBody());
  testNamespacesModel.checkModel(model, NAMESPACE1, "hbase", "default");
  response = client.get(schemaPath);
  assertEquals(200, response.getCode());

  // Create another namespace and check that REST GET finds one additional namespace.
  createNamespaceViaAdmin(admin, NAMESPACE2);
  response = client.get(schemaPath, Constants.MIMETYPE_PROTOBUF);
  assertEquals(200, response.getCode());
  model.getObjectFromMessage(response.getBody());
  testNamespacesModel.checkModel(model, NAMESPACE1, NAMESPACE2, "hbase", "default");
  response = client.get(schemaPath);
  assertEquals(200, response.getCode());

  // Delete namespace and check that REST GET still finds correct namespaces.
  admin.deleteNamespace(NAMESPACE1);
  response = client.get(schemaPath, Constants.MIMETYPE_PROTOBUF);
  assertEquals(200, response.getCode());
  model.getObjectFromMessage(response.getBody());
  testNamespacesModel.checkModel(model, NAMESPACE2, "hbase", "default");
  response = client.get(schemaPath);
  assertEquals(200, response.getCode());

  admin.deleteNamespace(NAMESPACE2);
}
 
Example 19
Source File: TestMasterQuotasObserver.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testNamespaceSpaceAndRPCQuotaRemoved() throws Exception {
  final Connection conn = TEST_UTIL.getConnection();
  final Admin admin = conn.getAdmin();
  final String ns = testName.getMethodName();
  // Drop the ns if it somehow exists
  if (namespaceExists(ns)) {
    admin.deleteNamespace(ns);
  }

  // Create the ns
  NamespaceDescriptor desc = NamespaceDescriptor.create(ns).build();
  admin.createNamespace(desc);

  assertEquals(0, getNumSpaceQuotas());
  assertEquals(0, getThrottleQuotas());

  // Set Both quotas
  QuotaSettings settings =
      QuotaSettingsFactory.limitNamespaceSpace(ns, 1024L, SpaceViolationPolicy.NO_INSERTS);
  admin.setQuota(settings);

  settings =
      QuotaSettingsFactory.throttleNamespace(ns, ThrottleType.REQUEST_SIZE, 2L, TimeUnit.HOURS);
  admin.setQuota(settings);

  assertEquals(1, getNumSpaceQuotas());
  assertEquals(1, getThrottleQuotas());

  // Remove Space quota
  settings = QuotaSettingsFactory.removeNamespaceSpaceLimit(ns);
  admin.setQuota(settings);
  assertEquals(0, getNumSpaceQuotas());
  assertEquals(1, getThrottleQuotas());

  // Set back the space quota
  settings = QuotaSettingsFactory.limitNamespaceSpace(ns, 1024L, SpaceViolationPolicy.NO_INSERTS);
  admin.setQuota(settings);
  assertEquals(1, getNumSpaceQuotas());
  assertEquals(1, getThrottleQuotas());

  // Remove the throttle quota
  settings = QuotaSettingsFactory.unthrottleNamespace(ns);
  admin.setQuota(settings);
  assertEquals(1, getNumSpaceQuotas());
  assertEquals(0, getThrottleQuotas());

  // Set back the throttle quota
  settings =
      QuotaSettingsFactory.throttleNamespace(ns, ThrottleType.REQUEST_SIZE, 2L, TimeUnit.HOURS);
  admin.setQuota(settings);
  assertEquals(1, getNumSpaceQuotas());
  assertEquals(1, getThrottleQuotas());

  // Delete the namespace and check that both the quotas have been dropped as well
  admin.deleteNamespace(ns);

  assertEquals(0, getNumSpaceQuotas());
  assertEquals(0, getThrottleQuotas());
}
 
Example 20
Source File: TestNamespaceReplicationWithBulkLoadedData.java    From hbase with Apache License 2.0 4 votes vote down vote up
@After
@Override
public void tearDownBase() throws Exception {
  super.tearDownBase();
  TableDescriptor table1 = TableDescriptorBuilder.newBuilder(NS1_TABLE)
      .setColumnFamily(
          ColumnFamilyDescriptorBuilder.newBuilder(famName)
              .setScope(HConstants.REPLICATION_SCOPE_GLOBAL).build())
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(noRepfamName)).build();

  TableDescriptor table2 = TableDescriptorBuilder.newBuilder(NS2_TABLE)
      .setColumnFamily(
          ColumnFamilyDescriptorBuilder.newBuilder(famName)
              .setScope(HConstants.REPLICATION_SCOPE_GLOBAL).build())
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(noRepfamName)).build();
  Admin admin1 = UTIL1.getAdmin();
  admin1.disableTable(table1.getTableName());
  admin1.deleteTable(table1.getTableName());
  admin1.disableTable(table2.getTableName());
  admin1.deleteTable(table2.getTableName());
  admin1.deleteNamespace(NS1);
  admin1.deleteNamespace(NS2);

  Admin admin2 = UTIL2.getAdmin();
  admin2.disableTable(table1.getTableName());
  admin2.deleteTable(table1.getTableName());
  admin2.disableTable(table2.getTableName());
  admin2.deleteTable(table2.getTableName());
  admin2.deleteNamespace(NS1);
  admin2.deleteNamespace(NS2);

  Admin admin3 = UTIL3.getAdmin();
  admin3.disableTable(table1.getTableName());
  admin3.deleteTable(table1.getTableName());
  admin3.disableTable(table2.getTableName());
  admin3.deleteTable(table2.getTableName());
  admin3.deleteNamespace(NS1);
  admin3.deleteNamespace(NS2);

  Admin admin4 = UTIL4.getAdmin();
  admin4.disableTable(table1.getTableName());
  admin4.deleteTable(table1.getTableName());
  admin4.disableTable(table2.getTableName());
  admin4.deleteTable(table2.getTableName());
  admin4.deleteNamespace(NS1);
  admin4.deleteNamespace(NS2);
  UTIL1.getAdmin().removeReplicationPeer(PEER4_NS);
  UTIL1.getAdmin().removeReplicationPeer(PEER4_NS_TABLE);
}