if (isQuotaEnabled() && !table.isSystemTable() && isRpcThrottleEnabled()) { UserQuotaState userQuotaState = quotaCache.getUserQuotaState(ugi); QuotaLimiter userLimiter = userQuotaState.getTableLimiter(table);
private void testSwitchRpcThrottle(Admin admin, boolean oldRpcThrottle, boolean newRpcThrottle) throws IOException { boolean state = admin.switchRpcThrottle(newRpcThrottle); Assert.assertEquals(oldRpcThrottle, state); Assert.assertEquals(newRpcThrottle, admin.isRpcThrottleEnabled()); TEST_UTIL.getHBaseCluster().getRegionServerThreads().stream() .forEach(rs -> Assert.assertEquals(newRpcThrottle, rs.getRegionServer().getRegionServerRpcQuotaManager().isRpcThrottleEnabled())); }
@Test public void testRpcThrottleWhenStartup() throws IOException, InterruptedException { TEST_UTIL.getAdmin().switchRpcThrottle(false); assertFalse(TEST_UTIL.getAdmin().isRpcThrottleEnabled()); TEST_UTIL.killMiniHBaseCluster(); TEST_UTIL.startMiniHBaseCluster(); assertFalse(TEST_UTIL.getAdmin().isRpcThrottleEnabled()); for (JVMClusterUtil.RegionServerThread rs : TEST_UTIL.getHBaseCluster() .getRegionServerThreads()) { RegionServerRpcQuotaManager quotaManager = rs.getRegionServer().getRegionServerRpcQuotaManager(); assertFalse(quotaManager.isRpcThrottleEnabled()); } // enable rpc throttle TEST_UTIL.getAdmin().switchRpcThrottle(true); assertTrue(TEST_UTIL.getAdmin().isRpcThrottleEnabled()); }