You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by el...@apache.org on 2018/08/17 18:55:37 UTC
hbase git commit: HBASE-20705 Having RPC quota on a table now no
longer prevents Space Quota to be recreate/removed
Repository: hbase
Updated Branches:
refs/heads/branch-2.1 c1c12605a -> 48dee7e44
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 <el...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/48dee7e4
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/48dee7e4
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/48dee7e4
Branch: refs/heads/branch-2.1
Commit: 48dee7e44d0558995cfb2c90cd4dca38390bd685
Parents: c1c1260
Author: Sakthi <ja...@cloudera.com>
Authored: Tue Aug 7 13:36:15 2018 -0700
Committer: Josh Elser <el...@apache.org>
Committed: Fri Aug 17 14:09:26 2018 -0400
----------------------------------------------------------------------
.../hbase/quotas/TestMasterQuotasObserver.java | 67 ++++++++++++++++++++
1 file changed, 67 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/48dee7e4/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestMasterQuotasObserver.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestMasterQuotasObserver.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestMasterQuotasObserver.java
index b6b7924..92e1d9d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestMasterQuotasObserver.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestMasterQuotasObserver.java
@@ -138,6 +138,38 @@ public class TestMasterQuotasObserver {
}
@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
public void testNamespaceSpaceQuotaRemoved() throws Exception {
final Connection conn = TEST_UTIL.getConnection();
final Admin admin = conn.getAdmin();
@@ -190,6 +222,41 @@ public class TestMasterQuotasObserver {
}
@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
public void testObserverAddedByDefault() throws Exception {
final HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
final MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();