HBASE-20705 Having RPC quota on a table now no longer prevents Space Quota to be recreate/removed
Just added 2 test cases as the subtasks of this jira solves the issue Signed-off-by: Josh Elser <elserj@apache.org>
This commit is contained in:
parent
c1c12605ad
commit
48dee7e44d
|
@ -137,6 +137,38 @@ public class TestMasterQuotasObserver {
|
||||||
assertEquals(0, getThrottleQuotas());
|
assertEquals(0, getThrottleQuotas());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTableSpaceAndRPCQuotaRemoved() throws Exception {
|
||||||
|
final Connection conn = TEST_UTIL.getConnection();
|
||||||
|
final Admin admin = conn.getAdmin();
|
||||||
|
final TableName tn = TableName.valueOf(testName.getMethodName());
|
||||||
|
// Drop the table if it somehow exists
|
||||||
|
if (admin.tableExists(tn)) {
|
||||||
|
dropTable(admin, tn);
|
||||||
|
}
|
||||||
|
|
||||||
|
createTable(admin, tn);
|
||||||
|
assertEquals(0, getNumSpaceQuotas());
|
||||||
|
assertEquals(0, getThrottleQuotas());
|
||||||
|
|
||||||
|
// Set Both quotas
|
||||||
|
QuotaSettings settings =
|
||||||
|
QuotaSettingsFactory.limitTableSpace(tn, 1024L, SpaceViolationPolicy.NO_INSERTS);
|
||||||
|
admin.setQuota(settings);
|
||||||
|
|
||||||
|
settings =
|
||||||
|
QuotaSettingsFactory.throttleTable(tn, ThrottleType.REQUEST_SIZE, 2L, TimeUnit.HOURS);
|
||||||
|
admin.setQuota(settings);
|
||||||
|
|
||||||
|
assertEquals(1, getNumSpaceQuotas());
|
||||||
|
assertEquals(1, getThrottleQuotas());
|
||||||
|
|
||||||
|
// Delete the table and observe the quotas being automatically deleted as well
|
||||||
|
dropTable(admin, tn);
|
||||||
|
assertEquals(0, getNumSpaceQuotas());
|
||||||
|
assertEquals(0, getThrottleQuotas());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamespaceSpaceQuotaRemoved() throws Exception {
|
public void testNamespaceSpaceQuotaRemoved() throws Exception {
|
||||||
final Connection conn = TEST_UTIL.getConnection();
|
final Connection conn = TEST_UTIL.getConnection();
|
||||||
|
@ -189,6 +221,41 @@ public class TestMasterQuotasObserver {
|
||||||
assertEquals(0, getThrottleQuotas());
|
assertEquals(0, getThrottleQuotas());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNamespaceSpaceAndRPCQuotaRemoved() throws Exception {
|
||||||
|
final Connection conn = TEST_UTIL.getConnection();
|
||||||
|
final Admin admin = conn.getAdmin();
|
||||||
|
final TableName tn = TableName.valueOf(testName.getMethodName());
|
||||||
|
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());
|
||||||
|
|
||||||
|
// Delete the namespace and observe the quotas being automatically deleted as well
|
||||||
|
admin.deleteNamespace(ns);
|
||||||
|
assertEquals(0, getNumSpaceQuotas());
|
||||||
|
assertEquals(0, getThrottleQuotas());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testObserverAddedByDefault() throws Exception {
|
public void testObserverAddedByDefault() throws Exception {
|
||||||
final HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
|
final HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
|
||||||
|
|
Loading…
Reference in New Issue