Skip to content

Commit 5942177

Browse files
rmdmattinglybbeaudreault
authored andcommitted
HBASE-27253 make slowlog configurations dynamic (apache#4926)
Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org>
1 parent 120866a commit 5942177

1 file changed

Lines changed: 35 additions & 7 deletions

File tree

hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public abstract class RpcServer implements RpcServerInterface, ConfigurationObse
9292
private static final String MULTI_SERVICE_CALLS = "multi.service_calls";
9393

9494
private final boolean authorize;
95-
private final boolean isOnlineLogProviderEnabled;
95+
private volatile boolean isOnlineLogProviderEnabled;
9696
protected boolean isSecurityEnabled;
9797

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

198198
protected final int maxRequestSize;
199-
protected final int warnResponseTime;
200-
protected final int warnResponseSize;
199+
protected volatile int warnResponseTime;
200+
protected volatile int warnResponseSize;
201201

202202
protected final int minClientRequestTimeout;
203203

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

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

300-
this.isOnlineLogProviderEnabled = conf.getBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY,
301-
HConstants.DEFAULT_ONLINE_LOG_PROVIDER_ENABLED);
300+
this.isOnlineLogProviderEnabled = getIsOnlineLogProviderEnabled(conf);
302301
this.scheduler = scheduler;
303302
}
304303

@@ -311,6 +310,35 @@ public void onConfigurationChange(Configuration newConf) {
311310
if (authorize) {
312311
refreshAuthManager(newConf, new HBasePolicyProvider());
313312
}
313+
refreshSlowLogConfiguration(newConf);
314+
}
315+
316+
private void refreshSlowLogConfiguration(Configuration newConf) {
317+
boolean newIsOnlineLogProviderEnabled = getIsOnlineLogProviderEnabled(newConf);
318+
if (isOnlineLogProviderEnabled != newIsOnlineLogProviderEnabled) {
319+
isOnlineLogProviderEnabled = newIsOnlineLogProviderEnabled;
320+
}
321+
int newWarnResponseTime = getWarnResponseTime(newConf);
322+
if (warnResponseTime != newWarnResponseTime) {
323+
warnResponseTime = newWarnResponseTime;
324+
}
325+
int newWarnResponseSize = getWarnResponseSize(newConf);
326+
if (warnResponseSize != newWarnResponseSize) {
327+
warnResponseSize = newWarnResponseSize;
328+
}
329+
}
330+
331+
private static boolean getIsOnlineLogProviderEnabled(Configuration conf) {
332+
return conf.getBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY,
333+
HConstants.DEFAULT_ONLINE_LOG_PROVIDER_ENABLED);
334+
}
335+
336+
private static int getWarnResponseTime(Configuration conf) {
337+
return conf.getInt(WARN_RESPONSE_TIME, DEFAULT_WARN_RESPONSE_TIME);
338+
}
339+
340+
private static int getWarnResponseSize(Configuration conf) {
341+
return conf.getInt(WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_SIZE);
314342
}
315343

316344
protected void initReconfigurable(Configuration confToLoad) {

0 commit comments

Comments
 (0)