This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new a65bb29aa6 Fix conditional in LowMemoryDetector (#3241)
a65bb29aa6 is described below
commit a65bb29aa66f2f60e3417fd43964309a12aa66d5
Author: Dave Marion <[email protected]>
AuthorDate: Thu Mar 16 11:16:33 2023 -0400
Fix conditional in LowMemoryDetector (#3241)
The check was executing the action before returning whether or
not the server was running low on memory. For actions that included
a wait, this would cause those processes to wait unnecessarily. This
changes the method such that the action is only executed if the server
is running low on memory
Closes #3240
---
.../main/java/org/apache/accumulo/server/mem/LowMemoryDetector.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/mem/LowMemoryDetector.java
b/server/base/src/main/java/org/apache/accumulo/server/mem/LowMemoryDetector.java
index 362f6ef173..e08eed772b 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/mem/LowMemoryDetector.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/mem/LowMemoryDetector.java
@@ -89,9 +89,9 @@ public class LowMemoryDetector {
}
boolean isEnabled = context.getConfiguration().getBoolean(p);
// Only incur the penalty of accessing the volatile variable when
enabled for this scope
- if (isEnabled) {
+ if (isEnabled && runningLowOnMemory) {
action.execute();
- return runningLowOnMemory;
+ return true;
}
}
return false;