You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2022/09/01 21:05:58 UTC

[accumulo] branch main updated: Mark FileSystemMonitor as deprecated and slated for 3.0 removal (#2909)

This is an automated email from the ASF dual-hosted git repository.

ctubbsii 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 3a29c2ed7c Mark FileSystemMonitor as deprecated and slated for 3.0 removal (#2909)
3a29c2ed7c is described below

commit 3a29c2ed7c8eab7700c8f341e24feddb64ebcb59
Author: EdColeman <de...@etcoleman.com>
AuthorDate: Thu Sep 1 21:05:52 2022 +0000

    Mark FileSystemMonitor as deprecated and slated for 3.0 removal (#2909)
    
    * mark FileSystemMonitor as deprecated and slated for 3.0 removal
    * Remove unnecessary second boolean check on property (avoids passing
      property when not needed)
    * Use local variable to narrow the warning suppression to just the
      variable and not the whole method
    * IDE also replaced anonymous inner class with lambda
    
    Co-authored-by: Christopher Tubbs <ct...@apache.org>
---
 .../org/apache/accumulo/core/conf/Property.java    |  1 +
 .../accumulo/server/util/FileSystemMonitor.java    | 29 ++++++++--------------
 .../org/apache/accumulo/tserver/TabletServer.java  |  7 +++++-
 3 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 577300b769..8c65e4432b 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -703,6 +703,7 @@ public enum Property {
       "The number of concurrent threads that will load bloom filters in the background. "
           + "Setting this to zero will make bloom filters load in the foreground.",
       "1.3.5"),
+  @Deprecated(since = "2.1.0", forRemoval = true)
   TSERV_MONITOR_FS("tserver.monitor.fs", "false", PropertyType.BOOLEAN,
       "When enabled the tserver will monitor file systems and kill itself when"
           + " one switches from rw to ro. This is usually and indication that Linux has"
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java b/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
index 332f7c66de..c62c9bea30 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
@@ -31,7 +31,6 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.Halt;
 import org.apache.accumulo.core.util.threads.ThreadPools;
 import org.apache.accumulo.core.util.threads.Threads;
@@ -121,12 +120,8 @@ public class FileSystemMonitor {
             try {
               checkMount(mount);
             } catch (final Exception e) {
-              Halt.halt(-42, new Runnable() {
-                @Override
-                public void run() {
-                  log.error("Exception while checking mount points, halting process", e);
-                }
-              });
+              Halt.halt(-42,
+                  () -> log.error("Exception while checking mount points, halting process", e));
             }
           }));
     }
@@ -145,18 +140,16 @@ public class FileSystemMonitor {
       throw new Exception("Filesystem " + mount.mountPoint + " switched to read only");
   }
 
-  public static void start(AccumuloConfiguration conf, Property prop) {
-    if (conf.getBoolean(prop)) {
-      if (new File(PROC_MOUNTS).exists()) {
-        try {
-          new FileSystemMonitor(PROC_MOUNTS, 60000, conf);
-          log.info("Filesystem monitor started");
-        } catch (IOException e) {
-          log.error("Failed to initialize file system monitor", e);
-        }
-      } else {
-        log.info("Not monitoring filesystems, " + PROC_MOUNTS + " does not exists");
+  public static void start(AccumuloConfiguration conf) {
+    if (new File(PROC_MOUNTS).exists()) {
+      try {
+        new FileSystemMonitor(PROC_MOUNTS, 60000, conf);
+        log.info("Filesystem monitor started");
+      } catch (IOException e) {
+        log.error("Failed to initialize file system monitor", e);
       }
+    } else {
+      log.info("Not monitoring filesystems, " + PROC_MOUNTS + " does not exists");
     }
   }
 }
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index d15b27ae57..239f3ef91a 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -1048,7 +1048,12 @@ public class TabletServer extends AbstractServer implements TabletHostingServer
 
     final AccumuloConfiguration aconf = getConfiguration();
 
-    FileSystemMonitor.start(aconf, Property.TSERV_MONITOR_FS);
+    @SuppressWarnings("removal")
+    Property TSERV_MONITOR_FS = Property.TSERV_MONITOR_FS;
+    if (aconf.getBoolean(TSERV_MONITOR_FS)) {
+      log.warn("{} is deprecated and marked for removal.", TSERV_MONITOR_FS.getKey());
+      FileSystemMonitor.start(aconf);
+    }
 
     Runnable gcDebugTask = () -> gcLogger.logGCInfo(getConfiguration());