Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-27253 Make slowlog configurations dynamic #4926

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public abstract class RpcServer implements RpcServerInterface, ConfigurationObse
private static final String MULTI_SERVICE_CALLS = "multi.service_calls";

private final boolean authorize;
private final boolean isOnlineLogProviderEnabled;
private volatile boolean isOnlineLogProviderEnabled;
protected boolean isSecurityEnabled;

public static final byte CURRENT_VERSION = 0;
Expand Down Expand Up @@ -196,8 +196,8 @@ public abstract class RpcServer implements RpcServerInterface, ConfigurationObse
protected static final Gson GSON = GsonUtil.createGsonWithDisableHtmlEscaping().create();

protected final int maxRequestSize;
protected final int warnResponseTime;
protected final int warnResponseSize;
protected volatile int warnResponseTime;
protected volatile int warnResponseSize;

protected final int minClientRequestTimeout;

Expand Down Expand Up @@ -275,8 +275,8 @@ public RpcServer(final Server server, final String name,
this.maxQueueSizeInBytes =
this.conf.getLong("hbase.ipc.server.max.callqueue.size", DEFAULT_MAX_CALLQUEUE_SIZE);

this.warnResponseTime = conf.getInt(WARN_RESPONSE_TIME, DEFAULT_WARN_RESPONSE_TIME);
this.warnResponseSize = conf.getInt(WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_SIZE);
this.warnResponseTime = getWarnResponseTime(conf);
this.warnResponseSize = getWarnResponseSize(conf);
this.minClientRequestTimeout =
conf.getInt(MIN_CLIENT_REQUEST_TIMEOUT, DEFAULT_MIN_CLIENT_REQUEST_TIMEOUT);
this.maxRequestSize = conf.getInt(MAX_REQUEST_SIZE, DEFAULT_MAX_REQUEST_SIZE);
Expand All @@ -297,8 +297,7 @@ public RpcServer(final Server server, final String name,
saslProps = Collections.emptyMap();
}

this.isOnlineLogProviderEnabled = conf.getBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY,
HConstants.DEFAULT_ONLINE_LOG_PROVIDER_ENABLED);
this.isOnlineLogProviderEnabled = getIsOnlineLogProviderEnabled(conf);
this.scheduler = scheduler;
}

Expand All @@ -311,6 +310,35 @@ public void onConfigurationChange(Configuration newConf) {
if (authorize) {
refreshAuthManager(newConf, new HBasePolicyProvider());
}
refreshSlowLogConfiguration(newConf);
}

private void refreshSlowLogConfiguration(Configuration newConf) {
boolean newIsOnlineLogProviderEnabled = getIsOnlineLogProviderEnabled(newConf);
if (isOnlineLogProviderEnabled != newIsOnlineLogProviderEnabled) {
isOnlineLogProviderEnabled = newIsOnlineLogProviderEnabled;
}
int newWarnResponseTime = getWarnResponseTime(newConf);
if (warnResponseTime != newWarnResponseTime) {
warnResponseTime = newWarnResponseTime;
}
int newWarnResponseSize = getWarnResponseSize(newConf);
if (warnResponseSize != newWarnResponseSize) {
warnResponseSize = newWarnResponseSize;
}
}

private static boolean getIsOnlineLogProviderEnabled(Configuration conf) {
return conf.getBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY,
HConstants.DEFAULT_ONLINE_LOG_PROVIDER_ENABLED);
}

private static int getWarnResponseTime(Configuration conf) {
return conf.getInt(WARN_RESPONSE_TIME, DEFAULT_WARN_RESPONSE_TIME);
}

private static int getWarnResponseSize(Configuration conf) {
return conf.getInt(WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_SIZE);
}

protected void initReconfigurable(Configuration confToLoad) {
Expand Down