HBASE-22513 Admin#getQuota does not work correctly if exceedThrottleQuota is set

This commit is contained in:
meiyi 2019-06-03 16:55:23 +08:00 committed by meiyi
parent d1035c8d9b
commit 17ea99c83d
2 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import java.util.Objects;
import java.util.Queue;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -102,6 +103,11 @@ public class QuotaRetriever implements Closeable, Iterable<QuotaSettings> {
public QuotaSettings next() throws IOException {
if (cache.isEmpty()) {
Result result = scanner.next();
// Skip exceedThrottleQuota row key because this is not a QuotaSettings
if (result != null
&& Bytes.equals(result.getRow(), QuotaTableUtil.getExceedThrottleQuotaRowKey())) {
result = scanner.next();
}
if (result == null) {
return null;
}

View File

@ -636,6 +636,7 @@ public class TestQuotaAdmin {
assertTrue(admin.exceedThrottleQuotaSwitch(true));
assertTrue(admin.exceedThrottleQuotaSwitch(false));
assertFalse(admin.exceedThrottleQuotaSwitch(false));
assertEquals(2, admin.getQuota(new QuotaFilter()).size());
admin.setQuota(QuotaSettingsFactory.unthrottleRegionServer(regionServer));
}