/** * Open a QuotaRetriever with no filter, all the quota settings will be returned. * @param conf Configuration object to use. * @return the QuotaRetriever * @throws IOException if a remote or network exception occurs */ public static QuotaRetriever open(final Configuration conf) throws IOException { return open(conf, null); }
@Override public QuotaRetriever getQuotaRetriever(final QuotaFilter filter) throws IOException { return QuotaRetriever.open(conf, filter); }
@Override public List<QuotaSettings> getQuota(QuotaFilter filter) throws IOException { List<QuotaSettings> quotas = new LinkedList<>(); try (QuotaRetriever retriever = QuotaRetriever.open(conf, filter)) { Iterator<QuotaSettings> iterator = retriever.iterator(); while (iterator.hasNext()) { quotas.add(iterator.next()); } } return quotas; }
private int countResults(final QuotaFilter filter) throws Exception { QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration(), filter); try { int count = 0; for (QuotaSettings settings: scanner) { LOG.debug(Objects.toString(settings)); count++; } return count; } finally { scanner.close(); } } }
try (Admin admin = conn.getAdmin()) { for (QuotaSettings qs : QuotaRetriever.open(conf, filter)) { if (qs.getQuotaType() == QuotaType.SPACE) { String ns = qs.getNamespace();
public int getNumSpaceQuotas() throws Exception { QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration()); int numSpaceQuotas = 0; for (QuotaSettings quotaSettings : scanner) { if (quotaSettings.getQuotaType() == QuotaType.SPACE) { numSpaceQuotas++; } } return numSpaceQuotas; }
public int getThrottleQuotas() throws Exception { QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration()); int throttleQuotas = 0; for (QuotaSettings quotaSettings : scanner) { if (quotaSettings.getQuotaType() == QuotaType.THROTTLE) { throttleQuotas++; } } return throttleQuotas; }
private void verifyNotFetchableViaAPI(Admin admin) throws Exception { // Verify that we can also not fetch it via the API try (QuotaRetriever quotaScanner = QuotaRetriever.open(admin.getConfiguration())) { assertNull("Did not expect to find a quota entry", quotaScanner.next()); } }
private void verifyFetchableViaAPI(Admin admin, ThrottleType type, long limit, TimeUnit tu) throws Exception { // Verify we can retrieve the new quota via the QuotaRetriever API try (QuotaRetriever quotaScanner = QuotaRetriever.open(admin.getConfiguration())) { assertRPCQuota(type, limit, tu, Iterables.getOnlyElement(quotaScanner)); } }
/** * Returns the number of quotas defined in the HBase quota table. */ long listNumDefinedQuotas(Connection conn) throws IOException { QuotaRetriever scanner = QuotaRetriever.open(conn.getConfiguration()); try { return Iterables.size(scanner); } finally { if (scanner != null) { scanner.close(); } } }
@Override public QuotaRetriever getQuotaRetriever(final QuotaFilter filter) throws IOException { return QuotaRetriever.open(conf, filter); }
/** * Open a QuotaRetriever with no filter, all the quota settings will be returned. * @param conf Configuration object to use. * @return the QuotaRetriever * @throws IOException if a remote or network exception occurs */ public static QuotaRetriever open(final Configuration conf) throws IOException { return open(conf, null); }
QuotaSettings getTableSpaceQuota(Connection conn, TableName tn) throws IOException { try (QuotaRetriever scanner = QuotaRetriever.open( conn.getConfiguration(), new QuotaFilter().setTableFilter(tn.getNameAsString()))) { for (QuotaSettings setting : scanner) { if (setting.getTableName().equals(tn) && setting.getQuotaType() == QuotaType.SPACE) { return setting; } } return null; } }
} else { QuotaRetriever scanner = QuotaRetriever.open(conn.getConfiguration()); try { for (QuotaSettings quotaSettings : scanner) {
@Override public List<QuotaSettings> getQuota(QuotaFilter filter) throws IOException { List<QuotaSettings> quotas = new LinkedList<>(); try (QuotaRetriever retriever = QuotaRetriever.open(conf, filter)) { Iterator<QuotaSettings> iterator = retriever.iterator(); while (iterator.hasNext()) { quotas.add(iterator.next()); } } return quotas; }
QuotaRetriever quotaScanner = QuotaRetriever.open(admin.getConfiguration()); try { assertSpaceQuota(originalSizeLimit, violationPolicy, Iterables.getOnlyElement(quotaScanner)); quotaScanner = QuotaRetriever.open(admin.getConfiguration()); try { assertSpaceQuota(newSizeLimit, newViolationPolicy, Iterables.getOnlyElement(quotaScanner)); quotaScanner = QuotaRetriever.open(admin.getConfiguration()); try { assertNull("Did not expect to find a quota entry", quotaScanner.next());
admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, true)); try (QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration())) { int countThrottle = 0; int countGlobalBypass = 0;
30, TimeUnit.SECONDS)); int count = 0; QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration(), rsFilter); try { for (QuotaSettings settings : scanner) {
admin.setQuota(QuotaSettingsFactory.bypassGlobals(userName, true)); try (QuotaRetriever scanner = QuotaRetriever.open(TEST_UTIL.getConfiguration())) { int countThrottle = 0; int countGlobalBypass = 0;