Skip to content

Commit fac011e

Browse files
bbeaudreaultapurtell
authored andcommitted
HBASE-26814 Addendum: Fix spotbugs warning and clarify intent (#4201)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Signed-off-by: Andrew Purtell <apurtell@apache.org>
1 parent 3ebb8c1 commit fac011e

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/throttle/StoreHotnessProtector.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
public class StoreHotnessProtector {
6363
private static final Logger LOG = LoggerFactory.getLogger(StoreHotnessProtector.class);
6464

65-
// We want to log just once so that users are aware of this tool
6665
private static volatile boolean loggedDisableMessage;
6766

6867
private volatile int parallelPutToStoreThreadLimit;
@@ -97,12 +96,23 @@ public void init(Configuration conf) {
9796
conf.getInt(PARALLEL_PUT_STORE_THREADS_LIMIT_MIN_COLUMN_COUNT,
9897
DEFAULT_PARALLEL_PUT_STORE_THREADS_LIMIT_MIN_COLUMN_NUM);
9998

100-
if (!isEnable() && !loggedDisableMessage) {
101-
loggedDisableMessage = true;
99+
if (!isEnable()) {
100+
logDisabledMessageOnce();
101+
}
102+
}
102103

104+
/**
105+
* {@link #init(Configuration)} is called for every Store that opens on a RegionServer.
106+
* Here we make a lightweight attempt to log this message once per RegionServer, rather than
107+
* per-Store. The goal is just to draw attention to this feature if debugging overload due to
108+
* heavy writes.
109+
*/
110+
private static void logDisabledMessageOnce() {
111+
if (!loggedDisableMessage) {
103112
LOG.info("StoreHotnessProtector is disabled. Set {} > 0 to enable, "
104113
+ "which may help mitigate load under heavy write pressure.",
105114
PARALLEL_PUT_STORE_THREADS_LIMIT);
115+
loggedDisableMessage = true;
106116
}
107117
}
108118

0 commit comments

Comments
 (0)