HBASE-22513 Admin#getQuota does not work correctly if exceedThrottleQuota is set
This commit is contained in:
parent
d1035c8d9b
commit
17ea99c83d
|
@ -26,6 +26,7 @@ import java.util.Objects;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import org.apache.yetus.audience.InterfaceAudience;
|
import org.apache.yetus.audience.InterfaceAudience;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -102,6 +103,11 @@ public class QuotaRetriever implements Closeable, Iterable<QuotaSettings> {
|
||||||
public QuotaSettings next() throws IOException {
|
public QuotaSettings next() throws IOException {
|
||||||
if (cache.isEmpty()) {
|
if (cache.isEmpty()) {
|
||||||
Result result = scanner.next();
|
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) {
|
if (result == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,6 +636,7 @@ public class TestQuotaAdmin {
|
||||||
assertTrue(admin.exceedThrottleQuotaSwitch(true));
|
assertTrue(admin.exceedThrottleQuotaSwitch(true));
|
||||||
assertTrue(admin.exceedThrottleQuotaSwitch(false));
|
assertTrue(admin.exceedThrottleQuotaSwitch(false));
|
||||||
assertFalse(admin.exceedThrottleQuotaSwitch(false));
|
assertFalse(admin.exceedThrottleQuotaSwitch(false));
|
||||||
|
assertEquals(2, admin.getQuota(new QuotaFilter()).size());
|
||||||
admin.setQuota(QuotaSettingsFactory.unthrottleRegionServer(regionServer));
|
admin.setQuota(QuotaSettingsFactory.unthrottleRegionServer(regionServer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue