當前位置: 首頁>>代碼示例>>Java>>正文


Java Admin.setQuota方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.Admin.setQuota方法的典型用法代碼示例。如果您正苦於以下問題:Java Admin.setQuota方法的具體用法?Java Admin.setQuota怎麽用?Java Admin.setQuota使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.Admin的用法示例。


在下文中一共展示了Admin.setQuota方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testUserGlobalThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerUserCacheRefresh(false, TABLE_NAMES);

  // should execute at max 6 requests
  assertEquals(6, doPuts(100, tables));

  // wait a minute and you should get other 6 requests executed
  waitMinuteQuota();
  assertEquals(6, doPuts(100, tables));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName));
  triggerUserCacheRefresh(true, TABLE_NAMES);
  assertEquals(60, doPuts(60, tables));
  assertEquals(60, doGets(60, tables));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:TestQuotaThrottle.java

示例2: testUserTableThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerUserCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 requests on tables[0] and have no limit on tables[1]
  assertEquals(6, doPuts(100, tables[0]));
  assertEquals(30, doPuts(30, tables[1]));

  // wait a minute and you should get other 6 requests executed
  waitMinuteQuota();
  assertEquals(6, doPuts(100, tables[0]));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName, TABLE_NAMES[0]));
  triggerUserCacheRefresh(true, TABLE_NAMES);
  assertEquals(60, doPuts(60, tables));
  assertEquals(60, doGets(60, tables));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:25,代碼來源:TestQuotaThrottle.java

示例3: testUserNamespaceThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerUserCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 requests on tables[0] and have no limit on tables[1]
  assertEquals(6, doPuts(100, tables[0]));

  // wait a minute and you should get other 6 requests executed
  waitMinuteQuota();
  assertEquals(6, doPuts(100, tables[1]));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName, NAMESPACE));
  triggerUserCacheRefresh(true, TABLE_NAMES);
  assertEquals(60, doPuts(60, tables));
  assertEquals(60, doGets(60, tables));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:25,代碼來源:TestQuotaThrottle.java

示例4: testTableGlobalThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerTableCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 requests
  assertEquals(6, doPuts(100, tables[0]));
  // should have no limits
  assertEquals(30, doPuts(30, tables[1]));

  // wait a minute and you should get other 6 requests executed
  waitMinuteQuota();
  assertEquals(6, doPuts(100, tables[0]));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0]));
  triggerTableCacheRefresh(true, TABLE_NAMES[0]);
  assertEquals(80, doGets(80, tables[0], tables[1]));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:TestQuotaThrottle.java

示例5: testNamespaceGlobalThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerNamespaceCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 requests
  assertEquals(6, doPuts(100, tables[0]));

  // wait a minute and you should get other 6 requests executed
  waitMinuteQuota();
  assertEquals(6, doPuts(100, tables[1]));

  admin.setQuota(QuotaSettingsFactory.unthrottleNamespace(NAMESPACE));
  triggerNamespaceCacheRefresh(true, TABLE_NAMES[0]);
  assertEquals(40, doPuts(40, tables[0]));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:22,代碼來源:TestQuotaThrottle.java

示例6: testUserGlobalReadAndWriteThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerUserCacheRefresh(false, TABLE_NAMES);

  // not limit for write request and should execute at max 6 read requests
  assertEquals(60, doPuts(60, tables));
  assertEquals(6, doGets(100, tables));

  waitMinuteQuota();

  // Add 6req/min limit for write request
  admin.setQuota(QuotaSettingsFactory
    .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
  assertEquals(6, doGets(100, tables));
  assertEquals(6, doPuts(60, tables));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName));
  triggerUserCacheRefresh(true, TABLE_NAMES);
  assertEquals(60, doPuts(60, tables));
  assertEquals(60, doGets(60, tables));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:32,代碼來源:TestQuotaThrottle.java

示例7: testUserTableReadAndWriteThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerUserCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 write requests and have no limit for read request
  assertEquals(6, doPuts(100, tables[0]));
  assertEquals(60, doGets(60, tables[0]));

  // no limit on tables[1]
  assertEquals(60, doPuts(60, tables[1]));
  assertEquals(60, doGets(60, tables[1]));

  // wait a minute and you should get other 6  write requests executed
  waitMinuteQuota();

  // Add 6req/min limit for read request on tables[0]
  admin.setQuota(QuotaSettingsFactory
    .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
  assertEquals(6, doPuts(100, tables[0]));
  assertEquals(6, doGets(60, tables[0]));

  // no limit on tables[1]
  assertEquals(30, doPuts(30, tables[1]));
  assertEquals(30, doGets(30, tables[1]));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName, TABLE_NAMES[0]));
  triggerUserCacheRefresh(true, TABLE_NAMES);
  assertEquals(60, doPuts(60, tables));
  assertEquals(60, doGets(60, tables));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:41,代碼來源:TestQuotaThrottle.java

示例8: testUserNamespaceReadAndWriteThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerUserCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 read requests and have no limit for write request
  assertEquals(6, doGets(60, tables[0]));
  assertEquals(60, doPuts(60, tables[0]));

  waitMinuteQuota();

  // Add 6req/min limit for write request, too
  admin.setQuota(QuotaSettingsFactory
    .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
  assertEquals(6, doGets(60, tables[0]));
  assertEquals(6, doPuts(60, tables[0]));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName, NAMESPACE));
  triggerUserCacheRefresh(true, TABLE_NAMES);
  assertEquals(60, doPuts(60, tables));
  assertEquals(60, doGets(60, tables));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:33,代碼來源:TestQuotaThrottle.java

示例9: testTableGlobalReadAndWriteThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerTableCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 read requests and have no limit for write request
  assertEquals(6, doGets(100, tables[0]));
  assertEquals(100, doPuts(100, tables[0]));
  // should have no limits on tables[1]
  assertEquals(30, doPuts(30, tables[1]));
  assertEquals(30, doGets(30, tables[1]));

  // wait a minute and you should get other 6 requests executed
  waitMinuteQuota();

  // Add 6req/min limit for write request, too
  admin.setQuota(QuotaSettingsFactory
    .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
  assertEquals(6, doGets(100, tables[0]));
  assertEquals(6, doPuts(100, tables[0]));
  // should have no limits on tables[1]
  assertEquals(30, doPuts(30, tables[1]));
  assertEquals(30, doGets(30, tables[1]));

  // Remove all the limits
  admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0]));
  triggerTableCacheRefresh(true, TABLE_NAMES[0]);
  assertEquals(80, doGets(80, tables[0], tables[1]));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:37,代碼來源:TestQuotaThrottle.java

示例10: testNamespaceGlobalReadAndWriteThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerNamespaceCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 6 write requests and no limit for read request
  assertEquals(6, doPuts(100, tables[0]));
  assertEquals(100, doGets(100, tables[0]));

  // wait a minute and you should get other 6 requests executed
  waitMinuteQuota();

  // Add 6req/min limit for read request, too
  admin.setQuota(QuotaSettingsFactory
    .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
  assertEquals(6, doPuts(100, tables[0]));
  assertEquals(6, doGets(100, tables[0]));

  admin.setQuota(QuotaSettingsFactory.unthrottleNamespace(NAMESPACE));
  triggerNamespaceCacheRefresh(true, TABLE_NAMES[0]);
  assertEquals(40, doPuts(40, tables[0]));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:31,代碼來源:TestQuotaThrottle.java

示例11: testSimpleScan

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@Test
public void testSimpleScan() throws Exception {
  Admin admin = TEST_UTIL.getHBaseAdmin();
  String userName = User.getCurrent().getShortName();

  admin.setQuota(QuotaSettingsFactory.throttleUser(userName, ThrottleType.REQUEST_NUMBER, 6,
    TimeUnit.MINUTES));
  admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, true));

  try (QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration())) {
    int countThrottle = 0;
    int countGlobalBypass = 0;
    for (QuotaSettings settings : scanner) {
      LOG.debug(settings);
      switch (settings.getQuotaType()) {
      case THROTTLE:
        ThrottleSettings throttle = (ThrottleSettings) settings;
        assertEquals(userName, throttle.getUserName());
        assertEquals(null, throttle.getTableName());
        assertEquals(null, throttle.getNamespace());
        assertEquals(6, throttle.getSoftLimit());
        assertEquals(TimeUnit.MINUTES, throttle.getTimeUnit());
        countThrottle++;
        break;
      case GLOBAL_BYPASS:
        countGlobalBypass++;
        break;
      default:
        fail("unexpected settings type: " + settings.getQuotaType());
      }
    }
    assertEquals(1, countThrottle);
    assertEquals(1, countGlobalBypass);
  }

  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName));
  assertNumResults(1, null);
  admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, false));
  assertNumResults(0, null);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:41,代碼來源:TestQuotaAdmin.java

示例12: testUserAndTableThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerUserCacheRefresh(false, TABLE_NAMES[0]);
  // Add 12req/min limit for the user
  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));
  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));
  triggerTableCacheRefresh(false, TABLE_NAMES[0]);

  // should execute at max 12 requests
  assertEquals(12, doGets(100, tables[2]));

  // should execute at max 8 requests
  waitMinuteQuota();
  assertEquals(8, doGets(100, tables[1]));

  // should execute at max 3 requests
  waitMinuteQuota();
  assertEquals(3, doPuts(100, tables[0]));

  // Remove all the throttling rules
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName, TABLE_NAMES[0]));
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName));
  triggerUserCacheRefresh(true, TABLE_NAMES[0], TABLE_NAMES[1]);

  admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[1]));
  triggerTableCacheRefresh(true, TABLE_NAMES[1]);
  waitMinuteQuota();
  assertEquals(40, doGets(40, tables[1]));

  admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0]));
  triggerTableCacheRefresh(true, TABLE_NAMES[0]);
  waitMinuteQuota();
  assertEquals(40, doGets(40, tables[0]));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:49,代碼來源:TestQuotaThrottle.java

示例13: testUserGlobalBypassThrottle

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@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));
  triggerTableCacheRefresh(false, TABLE_NAMES[0]);
  // Add 13req/min limit for the user
  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]
  assertEquals(6, doPuts(100, tables[0]));
  assertEquals(7, doGets(100, tables[1]));
  waitMinuteQuota();

  // 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));
  triggerUserCacheRefresh(false, TABLE_NAMES[2]);
  assertEquals(30, doGets(30, tables[0]));
  assertEquals(30, doGets(30, tables[1]));
  waitMinuteQuota();

  // Remove the global bypass
  // should execute at max 6 requests on table[0] and (13 - 6) on table[1]
  admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, false));
  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName, TABLE_NAMES[2]));
  triggerUserCacheRefresh(true, TABLE_NAMES[2]);
  assertEquals(6, doPuts(100, tables[0]));
  assertEquals(7, doGets(100, tables[1]));

  // unset throttle
  admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0]));
  admin.setQuota(QuotaSettingsFactory.unthrottleNamespace(NAMESPACE));
  waitMinuteQuota();
  triggerTableCacheRefresh(true, TABLE_NAMES[0]);
  triggerNamespaceCacheRefresh(true, TABLE_NAMES[1]);
  assertEquals(30, doGets(30, tables[0]));
  assertEquals(30, doGets(30, tables[1]));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:47,代碼來源:TestQuotaThrottle.java

示例14: testThrottleType

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@Test
public void testThrottleType() throws Exception {
  Admin admin = TEST_UTIL.getHBaseAdmin();
  String userName = User.getCurrent().getShortName();

  admin.setQuota(QuotaSettingsFactory
    .throttleUser(userName, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES));
  admin.setQuota(QuotaSettingsFactory
    .throttleUser(userName, ThrottleType.WRITE_NUMBER, 12, TimeUnit.MINUTES));
  admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, true));

  try (QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration())) {
    int countThrottle = 0;
    int countGlobalBypass = 0;
    for (QuotaSettings settings: scanner) {
      switch (settings.getQuotaType()) {
        case THROTTLE:
          ThrottleSettings throttle = (ThrottleSettings)settings;
          if (throttle.getSoftLimit() == 6) {
            assertEquals(ThrottleType.READ_NUMBER, throttle.getThrottleType());
          } else if (throttle.getSoftLimit() == 12) {
            assertEquals(ThrottleType.WRITE_NUMBER, throttle.getThrottleType());
          } else {
            fail("should not come here, because don't set quota with this limit");
          }
          assertEquals(userName, throttle.getUserName());
          assertEquals(null, throttle.getTableName());
          assertEquals(null, throttle.getNamespace());
          assertEquals(TimeUnit.MINUTES, throttle.getTimeUnit());
          countThrottle++;
          break;
        case GLOBAL_BYPASS:
          countGlobalBypass++;
          break;
        default:
          fail("unexpected settings type: " + settings.getQuotaType());
      }
    }
    assertEquals(2, countThrottle);
    assertEquals(1, countGlobalBypass);
  }

  admin.setQuota(QuotaSettingsFactory.unthrottleUser(userName));
  assertNumResults(1, null);
  admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, false));
  assertNumResults(0, null);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:48,代碼來源:TestQuotaAdmin.java


注:本文中的org.apache.hadoop.hbase.client.Admin.setQuota方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。