From 16e64f66623aa3b91a65411b52ca9db0d13ff8b2 Mon Sep 17 00:00:00 2001 From: yaojingyi Date: Wed, 27 Feb 2019 19:30:53 +0800 Subject: [PATCH] HBASE-21964 Unset Quota by Throttle Type Signed-off-by: Andrew Purtell --- .../hbase/quotas/QuotaSettingsFactory.java | 61 ++- .../hbase/quotas/MasterQuotaManager.java | 166 +++++--- .../hbase/quotas/TestQuotaThrottle.java | 368 ++++++++++++++---- hbase-shell/src/main/ruby/hbase/quotas.rb | 55 ++- 4 files changed, 494 insertions(+), 156 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java index 73d14e2b1c..737eadf37f 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java @@ -10,10 +10,6 @@ */ package org.apache.hadoop.hbase.quotas; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; @@ -22,6 +18,10 @@ import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetQuotaRequest; import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos; import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Quotas; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + @InterfaceAudience.Public @InterfaceStability.Evolving public class QuotaSettingsFactory { @@ -252,6 +252,56 @@ public class QuotaSettingsFactory { return throttle(null, null, namespace, null, 0, null); } + /** + * Remove the throttling for the specified table by specified type. + * + * @param tableName + * @param throttleType the throttleType + * @return the quota settings + */ + public static QuotaSettings unthrottleTable(final TableName tableName, + final ThrottleType throttleType) { + return throttle(null, tableName, null, throttleType, 0, null); + } + + /** + * Remove the throttling for the specified user on the specified namespace by specified type. + * + * @param userName the user + * @param namespace the namespace + * @param throttleType the throttleType + * @return the quota settings + */ + public static QuotaSettings unthrottleUserThrottleType(final String userName, + final String namespace, final ThrottleType throttleType) { + return throttle(userName, null, namespace, throttleType, 0, null); + } + + /** + * Remove the throttling for the specified user on the specified table by specified type. + * + * @param userName the user + * @param tableName the table + * @param throttleType the throttleType + * @return + */ + public static QuotaSettings unthrottleUserThrottleType(final String userName, + final TableName tableName, final ThrottleType throttleType) { + return throttle(userName, tableName, null, throttleType, 0, null); + } + + /** + * Remove the throttling for the specified user. + * + * @param userName the user + * @param throttleType the throttleType + * @return the quota settings + */ + public static QuotaSettings unthrottleUserThrottleType(final String userName, + final ThrottleType throttleType) { + return throttle(userName, null, null, throttleType, 0, null); + } + /* Throttle helper */ private static QuotaSettings throttle(final String userName, final TableName tableName, final String namespace, final ThrottleType type, final long limit, final TimeUnit timeUnit) { @@ -271,7 +321,8 @@ public class QuotaSettingsFactory { /** * Set the "bypass global settings" for the specified user - * @param userName the user to throttle + * + * @param userName the user to throttle * @param bypassGlobals true if the global settings should be bypassed * @return the quota settings */ diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java index f48533ddf4..1f49e1bcf2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.namespace.NamespaceAuditor; import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetQuotaRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetQuotaResponse; +import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos; import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Quotas; import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Throttle; import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.ThrottleRequest; @@ -391,83 +392,138 @@ public class MasterQuotaManager implements RegionStateListener { private void applyThrottle(final Quotas.Builder quotas, final ThrottleRequest req) throws IOException { Throttle.Builder throttle; - if (req.hasType() && (req.hasTimedQuota() || quotas.hasThrottle())) { // Validate timed quota if present + if (req.hasTimedQuota()) validateTimedQuota(req.getTimedQuota()); + if (req.hasTimedQuota()) { - validateTimedQuota(req.getTimedQuota()); - } - // apply the new settings - throttle = quotas.hasThrottle() ? quotas.getThrottle().toBuilder() : Throttle.newBuilder(); + throttle = quotas.getThrottle().toBuilder(); - switch (req.getType()) { + switch (req.getType()) { case REQUEST_NUMBER: - if (req.hasTimedQuota()) { - throttle.setReqNum(req.getTimedQuota()); - } else { - throttle.clearReqNum(); - } + throttle.setReqNum(req.getTimedQuota()); break; case REQUEST_SIZE: - if (req.hasTimedQuota()) { - throttle.setReqSize(req.getTimedQuota()); - } else { - throttle.clearReqSize(); - } + throttle.setReqSize(req.getTimedQuota()); break; case WRITE_NUMBER: - if (req.hasTimedQuota()) { - throttle.setWriteNum(req.getTimedQuota()); - } else { - throttle.clearWriteNum(); - } + throttle.setWriteNum(req.getTimedQuota()); break; case WRITE_SIZE: - if (req.hasTimedQuota()) { - throttle.setWriteSize(req.getTimedQuota()); - } else { - throttle.clearWriteSize(); - } + throttle.setWriteSize(req.getTimedQuota()); break; case READ_NUMBER: - if (req.hasTimedQuota()) { - throttle.setReadNum(req.getTimedQuota()); - } else { - throttle.clearReqNum(); - } + throttle.setReadNum(req.getTimedQuota()); break; case READ_SIZE: - if (req.hasTimedQuota()) { - throttle.setReadSize(req.getTimedQuota()); - } else { - throttle.clearReadSize(); - } - case REQUEST_CAPACITY_UNIT: - if (req.hasTimedQuota()) { - throttle.setReqCapacityUnit(req.getTimedQuota()); - } else { - throttle.clearReqCapacityUnit(); - } + throttle.setReadSize(req.getTimedQuota()); break; case READ_CAPACITY_UNIT: - if (req.hasTimedQuota()) { - throttle.setReadCapacityUnit(req.getTimedQuota()); - } else { - throttle.clearReadCapacityUnit(); - } + throttle.setReadCapacityUnit(req.getTimedQuota()); + break; + case REQUEST_CAPACITY_UNIT: + throttle.setReqCapacityUnit(req.getTimedQuota()); break; case WRITE_CAPACITY_UNIT: - if (req.hasTimedQuota()) { - throttle.setWriteCapacityUnit(req.getTimedQuota()); - } else { - throttle.clearWriteCapacityUnit(); - } + throttle.setWriteCapacityUnit(req.getTimedQuota()); break; - default: - throw new RuntimeException("Invalid throttle type: " + req.getType()); + } + quotas.setThrottle(throttle.build()); + + } else { + + throttle = Throttle.newBuilder(); + Throttle old_throttle = quotas.getThrottle(); + boolean toSetOldThrottle = false; + + for (QuotaProtos.ThrottleType quotaType : QuotaProtos.ThrottleType.values()) { + if (quotaType.equals(req.getType())) { + continue; + } + switch (quotaType) { + case REQUEST_NUMBER: + if (old_throttle.getReqNum().hasTimeUnit()) { + throttle.setReqNum(old_throttle.getReqNum()); + toSetOldThrottle = true; + } else { + throttle.clearReqNum(); + } + break; + case REQUEST_SIZE: + if (old_throttle.getReqSize().hasTimeUnit()) { + throttle.setReqSize(old_throttle.getReqSize()); + toSetOldThrottle = true; + } else { + throttle.clearReqSize(); + } + break; + case WRITE_NUMBER: + if (old_throttle.getWriteNum().hasTimeUnit()) { + throttle.setWriteNum(old_throttle.getWriteNum()); + toSetOldThrottle = true; + } else { + throttle.clearWriteNum(); + } + break; + case WRITE_SIZE: + if (old_throttle.getWriteSize().hasTimeUnit()) { + throttle.setWriteSize(old_throttle.getWriteSize()); + toSetOldThrottle = true; + } else { + throttle.clearWriteSize(); + } + break; + case READ_NUMBER: + if (old_throttle.getReadNum().hasTimeUnit()) { + throttle.setReadNum(old_throttle.getReadNum()); + toSetOldThrottle = true; + } else { + throttle.clearReadNum(); + } + break; + case READ_SIZE: + if (old_throttle.getReadSize().hasTimeUnit()) { + throttle.setReadSize(old_throttle.getReadSize()); + toSetOldThrottle = true; + } else { + throttle.clearReadSize(); + } + break; + case READ_CAPACITY_UNIT: + if (old_throttle.getReadCapacityUnit().hasTimeUnit()) { + throttle.setReadCapacityUnit(old_throttle.getReadCapacityUnit()); + toSetOldThrottle = true; + } else { + throttle.clearReadCapacityUnit(); + } + break; + case REQUEST_CAPACITY_UNIT: + if (old_throttle.getReqCapacityUnit().hasTimeUnit()) { + throttle.setReqCapacityUnit(old_throttle.getReqCapacityUnit()); + toSetOldThrottle = true; + } else { + throttle.clearReqCapacityUnit(); + } + break; + case WRITE_CAPACITY_UNIT: + if (old_throttle.getWriteCapacityUnit().hasTimeUnit()) { + throttle.setWriteCapacityUnit(old_throttle.getWriteCapacityUnit()); + toSetOldThrottle = true; + } else { + throttle.clearWriteCapacityUnit(); + } + break; + } + } + + if (toSetOldThrottle) { + quotas.setThrottle(throttle.build()); + } else { + quotas.clearThrottle(); + } + } - quotas.setThrottle(throttle.build()); } else { quotas.clearThrottle(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java index 227e68a714..016c912ee4 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java @@ -11,21 +11,12 @@ package org.apache.hadoop.hbase.quotas; -import static org.junit.Assert.assertEquals; - -import java.util.concurrent.TimeUnit; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.Admin; -import org.apache.hadoop.hbase.client.Get; -import org.apache.hadoop.hbase.client.HTable; -import org.apache.hadoop.hbase.client.Put; -import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException; -import org.apache.hadoop.hbase.client.Table; +import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.Bytes; @@ -39,8 +30,12 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; -@Category({ MediumTests.class }) -public class TestQuotaThrottle { +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +@Category({ MediumTests.class }) public class TestQuotaThrottle { final Log LOG = LogFactory.getLog(getClass()); private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); @@ -48,14 +43,14 @@ public class TestQuotaThrottle { private final static byte[] FAMILY = Bytes.toBytes("cf"); private final static byte[] QUALIFIER = Bytes.toBytes("q"); - private final static TableName[] TABLE_NAMES = new TableName[] { - TableName.valueOf("TestQuotaAdmin0"), TableName.valueOf("TestQuotaAdmin1"), - TableName.valueOf("TestQuotaAdmin2") }; + private final static TableName[] TABLE_NAMES = + new TableName[] { TableName.valueOf("TestQuotaAdmin0"), TableName.valueOf("TestQuotaAdmin1"), + TableName.valueOf("TestQuotaAdmin2") }; + private final static String[] NAMESPACE = { "ns1", "ns2", "ns3" }; private static HTable[] tables; - @BeforeClass - public static void setUpBeforeClass() throws Exception { + @BeforeClass public static void setUpBeforeClass() throws Exception { TEST_UTIL.getConfiguration().setBoolean(QuotaUtil.QUOTA_CONF_KEY, true); TEST_UTIL.getConfiguration().setInt("hbase.hstore.compactionThreshold", 10); TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100); @@ -74,8 +69,7 @@ public class TestQuotaThrottle { } } - @AfterClass - public static void tearDownAfterClass() throws Exception { + @AfterClass public static void tearDownAfterClass() throws Exception { for (int i = 0; i < tables.length; ++i) { if (tables[i] != null) { tables[i].close(); @@ -86,8 +80,7 @@ public class TestQuotaThrottle { TEST_UTIL.shutdownMiniCluster(); } - @After - public void tearDown() throws Exception { + @After public void tearDown() throws Exception { for (RegionServerThread rst : TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads()) { RegionServerQuotaManager quotaManager = rst.getRegionServer().getRegionServerQuotaManager(); QuotaCache quotaCache = quotaManager.getQuotaCache(); @@ -97,14 +90,13 @@ public class TestQuotaThrottle { } } - @Test(timeout = 60000) - public void testUserGlobalThrottle() throws Exception { + @Test(timeout = 60000) public void testUserGlobalThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); // Add 6req/min limit - admin.setQuota(QuotaSettingsFactory.throttleUser(userName, ThrottleType.REQUEST_NUMBER, 6, - TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES); // should execute at max 6 requests @@ -121,14 +113,13 @@ public class TestQuotaThrottle { assertEquals(60, doGets(60, tables)); } - @Test(timeout=60000) - public void testUserGlobalReadAndWriteThrottle() throws Exception { + @Test(timeout = 60000) public void testUserGlobalReadAndWriteThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); // Add 6req/min limit for read request - admin.setQuota(QuotaSettingsFactory - .throttleUser(userName, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota( + QuotaSettingsFactory.throttleUser(userName, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES); // not limit for write request and should execute at max 6 read requests @@ -139,7 +130,7 @@ public class TestQuotaThrottle { // Add 6req/min limit for write request admin.setQuota(QuotaSettingsFactory - .throttleUser(userName, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + .throttleUser(userName, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES); // should execute at max 6 read requests and at max 6 write write requests @@ -153,14 +144,13 @@ public class TestQuotaThrottle { assertEquals(60, doGets(60, tables)); } - @Test(timeout = 60000) - public void testUserTableThrottle() throws Exception { + @Test(timeout = 60000) public void testUserTableThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); // Add 6req/min limit - admin.setQuota(QuotaSettingsFactory.throttleUser(userName, TABLE_NAMES[0], - ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 requests on tables[0] and have no limit on tables[1] @@ -178,14 +168,13 @@ public class TestQuotaThrottle { assertEquals(60, doGets(60, tables)); } - @Test(timeout=60000) - public void testUserTableReadAndWriteThrottle() throws Exception { + @Test(timeout = 60000) public void testUserTableReadAndWriteThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); // Add 6req/min limit for write request on tables[0] admin.setQuota(QuotaSettingsFactory - .throttleUser(userName, TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 write requests and have no limit for read request @@ -201,7 +190,7 @@ public class TestQuotaThrottle { // Add 6req/min limit for read request on tables[0] admin.setQuota(QuotaSettingsFactory - .throttleUser(userName, TABLE_NAMES[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 read requests and at max 6 write requests @@ -219,15 +208,14 @@ public class TestQuotaThrottle { assertEquals(60, doGets(60, tables)); } - @Test(timeout = 60000) - public void testUserNamespaceThrottle() throws Exception { + @Test(timeout = 60000) public void testUserNamespaceThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); final String NAMESPACE = "default"; // Add 6req/min limit - admin.setQuota(QuotaSettingsFactory.throttleUser(userName, NAMESPACE, - ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE, ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 requests on tables[0] and have no limit on tables[1] @@ -244,15 +232,14 @@ public class TestQuotaThrottle { assertEquals(60, doGets(60, tables)); } - @Test(timeout=60000) - public void testUserNamespaceReadAndWriteThrottle() throws Exception { + @Test(timeout = 60000) public void testUserNamespaceReadAndWriteThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); final String NAMESPACE = "default"; // Add 6req/min limit for read request admin.setQuota(QuotaSettingsFactory - .throttleUser(userName, NAMESPACE, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + .throttleUser(userName, NAMESPACE, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 read requests and have no limit for write request @@ -263,7 +250,7 @@ public class TestQuotaThrottle { // Add 6req/min limit for write request, too admin.setQuota(QuotaSettingsFactory - .throttleUser(userName, NAMESPACE, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + .throttleUser(userName, NAMESPACE, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 read requests and at max 6 write requests @@ -277,13 +264,12 @@ public class TestQuotaThrottle { assertEquals(60, doGets(60, tables)); } - @Test(timeout = 60000) - public void testTableGlobalThrottle() throws Exception { + @Test(timeout = 60000) public void testTableGlobalThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); // Add 6req/min limit - admin.setQuota(QuotaSettingsFactory.throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, - 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerTableCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 requests @@ -301,13 +287,12 @@ public class TestQuotaThrottle { assertEquals(80, doGets(80, tables[0], tables[1])); } - @Test(timeout=60000) - public void testTableGlobalReadAndWriteThrottle() throws Exception { + @Test(timeout = 60000) public void testTableGlobalReadAndWriteThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); // Add 6req/min limit for read request admin.setQuota(QuotaSettingsFactory - .throttleTable(TABLE_NAMES[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + .throttleTable(TABLE_NAMES[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); triggerTableCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 read requests and have no limit for write request @@ -322,7 +307,7 @@ public class TestQuotaThrottle { // Add 6req/min limit for write request, too admin.setQuota(QuotaSettingsFactory - .throttleTable(TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + .throttleTable(TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); triggerTableCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 read requests and at max 6 write requests @@ -338,14 +323,13 @@ public class TestQuotaThrottle { assertEquals(80, doGets(80, tables[0], tables[1])); } - @Test(timeout = 60000) - public void testNamespaceGlobalThrottle() throws Exception { + @Test(timeout = 60000) public void testNamespaceGlobalThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String NAMESPACE = "default"; // Add 6req/min limit - admin.setQuota(QuotaSettingsFactory.throttleNamespace(NAMESPACE, ThrottleType.REQUEST_NUMBER, - 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE, ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerNamespaceCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 requests @@ -360,14 +344,13 @@ public class TestQuotaThrottle { assertEquals(40, doPuts(40, tables[0])); } - @Test(timeout=60000) - public void testNamespaceGlobalReadAndWriteThrottle() throws Exception { + @Test(timeout = 60000) public void testNamespaceGlobalReadAndWriteThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String NAMESPACE = "default"; // Add 6req/min limit for write request admin.setQuota(QuotaSettingsFactory - .throttleNamespace(NAMESPACE, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + .throttleNamespace(NAMESPACE, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); triggerNamespaceCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 write requests and no limit for read request @@ -379,7 +362,7 @@ public class TestQuotaThrottle { // Add 6req/min limit for read request, too admin.setQuota(QuotaSettingsFactory - .throttleNamespace(NAMESPACE, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + .throttleNamespace(NAMESPACE, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); triggerNamespaceCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 6 write requests and at max 6 read requests @@ -391,26 +374,25 @@ public class TestQuotaThrottle { assertEquals(40, doPuts(40, tables[0])); } - @Test(timeout = 60000) - public void testUserAndTableThrottle() throws Exception { + @Test(timeout = 60000) public void testUserAndTableThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); // Add 6req/min limit for the user on tables[0] - admin.setQuota(QuotaSettingsFactory.throttleUser(userName, TABLE_NAMES[0], - ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[0]); // Add 12req/min limit for the user - admin.setQuota(QuotaSettingsFactory.throttleUser(userName, ThrottleType.REQUEST_NUMBER, 12, - TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, ThrottleType.REQUEST_NUMBER, 12, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[1], TABLE_NAMES[2]); // Add 8req/min limit for the tables[1] - admin.setQuota(QuotaSettingsFactory.throttleTable(TABLE_NAMES[1], ThrottleType.REQUEST_NUMBER, - 8, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[1], ThrottleType.REQUEST_NUMBER, 8, TimeUnit.MINUTES)); triggerTableCacheRefresh(false, TABLE_NAMES[1]); // Add a lower table level throttle on tables[0] - admin.setQuota(QuotaSettingsFactory.throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, - 3, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 3, TimeUnit.MINUTES)); triggerTableCacheRefresh(false, TABLE_NAMES[0]); // should execute at max 12 requests @@ -440,19 +422,18 @@ public class TestQuotaThrottle { assertEquals(40, doGets(40, tables[0])); } - @Test(timeout = 60000) - public void testUserGlobalBypassThrottle() throws Exception { + @Test(timeout = 60000) public void testUserGlobalBypassThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); final String userName = User.getCurrent().getShortName(); final String NAMESPACE = "default"; // Add 6req/min limit for tables[0] - admin.setQuota(QuotaSettingsFactory.throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, - 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerTableCacheRefresh(false, TABLE_NAMES[0]); // Add 13req/min limit for the user - admin.setQuota(QuotaSettingsFactory.throttleNamespace(NAMESPACE, ThrottleType.REQUEST_NUMBER, - 13, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE, ThrottleType.REQUEST_NUMBER, 13, TimeUnit.MINUTES)); triggerNamespaceCacheRefresh(false, TABLE_NAMES[1]); // should execute at max 6 requests on table[0] and (13 - 6) on table[1] @@ -462,8 +443,8 @@ public class TestQuotaThrottle { // Set the global bypass for the user admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, true)); - admin.setQuota(QuotaSettingsFactory.throttleUser(userName, TABLE_NAMES[2], - ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[2], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); triggerUserCacheRefresh(false, TABLE_NAMES[2]); assertEquals(30, doGets(30, tables[0])); assertEquals(30, doGets(30, tables[1])); @@ -487,13 +468,12 @@ public class TestQuotaThrottle { assertEquals(30, doGets(30, tables[1])); } - @Test - public void testTableExistsGetThrottle() throws Exception { + @Test public void testTableExistsGetThrottle() throws Exception { final Admin admin = TEST_UTIL.getHBaseAdmin(); // Add throttle quota - admin.setQuota(QuotaSettingsFactory.throttleTable(TABLE_NAMES[0], - ThrottleType.REQUEST_NUMBER, 100, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 100, TimeUnit.MINUTES)); triggerTableCacheRefresh(false, TABLE_NAMES[0]); Table table = TEST_UTIL.getConnection().getTable(TABLE_NAMES[0]); @@ -658,7 +638,223 @@ public class TestQuotaThrottle { } private void waitMinuteQuota() { - EnvironmentEdgeManagerTestHelper.injectEdge(new IncrementingEnvironmentEdge( - EnvironmentEdgeManager.currentTime() + 70000)); + EnvironmentEdgeManagerTestHelper + .injectEdge(new IncrementingEnvironmentEdge(EnvironmentEdgeManager.currentTime() + 70000)); } + + @Test(timeout = 6 * 60 * 1000) public void testThrottleUnThrottleTable() throws Exception { + final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); + final String userName = User.getCurrent().getShortName(); + + // Add 6req/min limit for read request + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.READ_NUMBER, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.READ_SIZE, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.WRITE_SIZE, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[1], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[1], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[2], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleTable(TABLE_NAMES[2], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + for (ThrottleType quotaType : ThrottleType.values()) { + admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0], quotaType)); + } + + assertEquals(4, getQuotaSettingCount(admin)); + + } + + @Test(timeout = 6 * 60 * 1000) public void testThrottleUnThrottleTableUser() throws Exception { + final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); + final String userName = User.getCurrent().getShortName(); + + // Add 6req/min limit for read request + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.READ_NUMBER, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.READ_SIZE, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.WRITE_SIZE, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[1], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[1], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[2], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, TABLE_NAMES[2], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + for (ThrottleType quotaType : ThrottleType.values()) { + admin.setQuota( + QuotaSettingsFactory.unthrottleUserThrottleType(userName, TABLE_NAMES[0], quotaType)); + } + + assertEquals(4, getQuotaSettingCount(admin)); + + } + + @Test(timeout = 6 * 60 * 1000) public void testThrottleUnThrottleNameSpace() throws Exception { + final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); + final String userName = User.getCurrent().getShortName(); + + // Add 6req/min limit for read request + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[0], ThrottleType.READ_NUMBER, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[0], ThrottleType.READ_SIZE, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[0], ThrottleType.WRITE_SIZE, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[1], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[1], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[2], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleNamespace(NAMESPACE[2], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + for (ThrottleType quotaType : ThrottleType.values()) { + admin.setQuota(QuotaSettingsFactory.unthrottleNamespace(NAMESPACE[0])); + } + + assertEquals(4, getQuotaSettingCount(admin)); + + } + + @Test(timeout = 6 * 60 * 1000) public void testThrottleUnThrottleNameSpaceUser() + throws Exception { + final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); + final String userName = User.getCurrent().getShortName(); + + // Add 6req/min limit for read request + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[0], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[0], ThrottleType.READ_NUMBER, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[0], ThrottleType.READ_SIZE, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[0], ThrottleType.WRITE_SIZE, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[0], ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[0], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[1], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[1], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[2], ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, NAMESPACE[2], ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + for (ThrottleType quotaType : ThrottleType.values()) { + admin.setQuota( + QuotaSettingsFactory.unthrottleUserThrottleType(userName, NAMESPACE[0], quotaType)); + } + + assertEquals(4, getQuotaSettingCount(admin)); + + } + + @Test(timeout = 6 * 60 * 1000) public void testThrottleUnThrottleUser() throws Exception { + final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); + final String userName = User.getCurrent().getShortName(); + final String userName2 = "username2"; + final String userName3 = "username3"; + + // Add 6req/min limit for read request + admin.setQuota( + QuotaSettingsFactory.throttleUser(userName, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota( + QuotaSettingsFactory.throttleUser(userName, ThrottleType.READ_NUMBER, 7, TimeUnit.MINUTES)); + admin.setQuota( + QuotaSettingsFactory.throttleUser(userName, ThrottleType.READ_SIZE, 7, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota( + QuotaSettingsFactory.throttleUser(userName, ThrottleType.WRITE_SIZE, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, ThrottleType.REQUEST_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName2, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName2, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName3, ThrottleType.WRITE_NUMBER, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory + .throttleUser(userName3, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); + + for (ThrottleType quotaType : ThrottleType.values()) { + admin.setQuota(QuotaSettingsFactory.unthrottleUserThrottleType(userName, quotaType)); + } + + assertEquals(4, getQuotaSettingCount(admin)); + } + + @Test(timeout = 6 * 60 * 1000) public void testThrottleUnThrottleType() throws Exception { + final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); + + for (ThrottleType quotaType : ThrottleType.values()) { + admin.setQuota( + QuotaSettingsFactory.throttleTable(TABLE_NAMES[0], quotaType, 6, TimeUnit.MINUTES)); + admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0], quotaType)); + } + assertEquals(0, getQuotaSettingCount(admin)); + } + + public int getQuotaSettingCount(HBaseAdmin admin) throws IOException { + QuotaRetriever list_quotas = admin.getQuotaRetriever(new QuotaFilter()); + int quotaSettingCount = 0; + for (QuotaSettings setting : list_quotas) { + quotaSettingCount++; + LOG.info("Quota Setting:" + setting); + } + return quotaSettingCount; + } + } diff --git a/hbase-shell/src/main/ruby/hbase/quotas.rb b/hbase-shell/src/main/ruby/hbase/quotas.rb index cd938daf7f..4c20421814 100644 --- a/hbase-shell/src/main/ruby/hbase/quotas.rb +++ b/hbase-shell/src/main/ruby/hbase/quotas.rb @@ -32,6 +32,12 @@ module HBaseQuotasConstants REQUEST = 'REQUEST' WRITE = 'WRITE' READ = 'READ' + READ_NUMBER = 'READ_NUMBER' + READ_SIZE = 'READ_SIZE' + WRITE_NUMBER = 'WRITE_NUMBER' + WRITE_SIZE = 'WRITE_SIZE' + REQUEST_NUMBER = 'REQUEST_NUMBER' + REQUEST_SIZE = 'REQUEST_SIZE' end module Hbase @@ -83,24 +89,53 @@ module Hbase user = args.delete(USER) if args.has_key?(TABLE) table = TableName.valueOf(args.delete(TABLE)) - raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? - settings = QuotaSettingsFactory.unthrottleUser(user, table) + if args.has_key?(THROTTLE_TYPE) + throttle_type_str = args.delete(THROTTLE_TYPE) + throttle_type=_parse_throttle_type(ThrottleType,throttle_type_str) + settings = QuotaSettingsFactory.unthrottleUserThrottleType(user, table, throttle_type) + else + raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? + settings = QuotaSettingsFactory.unthrottleUser(user, table) + end elsif args.has_key?(NAMESPACE) namespace = args.delete(NAMESPACE) - raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? - settings = QuotaSettingsFactory.unthrottleUser(user, namespace) + if args.has_key?(THROTTLE_TYPE) + throttle_type_str = args.delete(THROTTLE_TYPE) + throttle_type=_parse_throttle_type(ThrottleType,throttle_type_str) + settings = QuotaSettingsFactory.unthrottleUserThrottleType(user, namespace,throttle_type) + else + raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? + settings = QuotaSettingsFactory.unthrottleUser(user, namespace) + end else - raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? - settings = QuotaSettingsFactory.unthrottleUser(user) + if args.has_key?(THROTTLE_TYPE) + throttle_type_str = args.delete(THROTTLE_TYPE) + throttle_type=_parse_throttle_type(ThrottleType,throttle_type_str) + settings = QuotaSettingsFactory.unthrottleUserThrottleType(user,throttle_type) + else + raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? + settings = QuotaSettingsFactory.unthrottleUser(user) + end end elsif args.has_key?(TABLE) table = TableName.valueOf(args.delete(TABLE)) - raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? - settings = QuotaSettingsFactory.unthrottleTable(table) + if args.has_key?(THROTTLE_TYPE) + throttle_type_str = args.delete(THROTTLE_TYPE) + throttle_type=_parse_throttle_type(ThrottleType,throttle_type_str) + settings = QuotaSettingsFactory.unthrottleTable(table,throttle_type) + else + raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? + settings = QuotaSettingsFactory.unthrottleTable(table) elsif args.has_key?(NAMESPACE) namespace = args.delete(NAMESPACE) - raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? - settings = QuotaSettingsFactory.unthrottleNamespace(namespace) + if args.has_key?(THROTTLE_TYPE) + throttle_type_str = args.delete(THROTTLE_TYPE) + throttle_type=_parse_throttle_type(ThrottleType,throttle_type_str) + settings = QuotaSettingsFactory.unthrottleNamespace(table,throttle_type) + else + raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty? + settings = QuotaSettingsFactory.unthrottleNamespace(namespace) + end else raise "One of USER, TABLE or NAMESPACE must be specified" end -- 2.21.0