use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaResponse in project hbase by apache.
the class MasterQuotaManager method switchExceedThrottleQuota.
public SwitchExceedThrottleQuotaResponse switchExceedThrottleQuota(SwitchExceedThrottleQuotaRequest request) throws IOException {
boolean enabled = request.getExceedThrottleQuotaEnabled();
if (initialized) {
masterServices.getMasterCoprocessorHost().preSwitchExceedThrottleQuota(enabled);
boolean previousEnabled = QuotaUtil.isExceedThrottleQuotaEnabled(masterServices.getConnection());
if (previousEnabled == enabled) {
LOG.warn("Skip switch exceed throttle quota to {} because it's the same with old value", enabled);
} else {
QuotaUtil.switchExceedThrottleQuota(masterServices.getConnection(), enabled);
LOG.info("{} switch exceed throttle quota from {} to {}", masterServices.getClientIdAuditPrefix(), previousEnabled, enabled);
}
SwitchExceedThrottleQuotaResponse response = SwitchExceedThrottleQuotaResponse.newBuilder().setPreviousExceedThrottleQuotaEnabled(previousEnabled).build();
masterServices.getMasterCoprocessorHost().postSwitchExceedThrottleQuota(previousEnabled, enabled);
return response;
} else {
LOG.warn("Skip switch exceed throttle quota to {} because quota is disabled", enabled);
return SwitchExceedThrottleQuotaResponse.newBuilder().setPreviousExceedThrottleQuotaEnabled(false).build();
}
}
Aggregations