zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iv...@apache.org
Subject svn commit: r1592705 - in /zookeeper/bookkeeper/trunk: ./ bookkeeper-server/conf/ bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/
Date Tue, 06 May 2014 10:30:55 GMT
Author: ivank
Date: Tue May  6 10:30:54 2014
New Revision: 1592705

URL: http://svn.apache.org/r1592705
Log:
BOOKKEEPER-744: Run the auditor bookie check periodically (ivank)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/conf/bk_server.conf
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1592705&r1=1592704&r2=1592705&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Tue May  6 10:30:54 2014
@@ -184,6 +184,8 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-716: padding writes for bookie journal (sijie via ivank)
 
+        BOOKKEEPER-744: Run the auditor bookie check periodically (ivank)
+
       hedwig-server:
 
         BOOKKEEPER-601: readahead cache size isn't updated correctly (sijie via fpj)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/conf/bk_server.conf
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/conf/bk_server.conf?rev=1592705&r1=1592704&r2=1592705&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/conf/bk_server.conf (original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/conf/bk_server.conf Tue May  6 10:30:54 2014
@@ -244,6 +244,15 @@ zkTimeout=10000
 # not be run more frequently than once a day.
 #auditorPeriodicCheckInterval=604800
 
+# The interval between auditor bookie checks.
+# The auditor bookie check, checks ledger metadata to see which bookies should
+# contain entries for each ledger. If a bookie which should contain entries is
+# unavailable, then the ledger containing that entry is marked for recovery.
+# Setting this to 0 disabled the periodic check. Bookie checks will still
+# run when a bookie fails.
+# The interval is specified in seconds.
+#auditorPeriodicBookieCheckInterval=84600
+
 # number of threads that should handle write requests. if zero, the writes would
 # be handled by netty threads directly.
 # numAddWorkerThreads=1

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java?rev=1592705&r1=1592704&r2=1592705&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
Tue May  6 10:30:54 2014
@@ -86,6 +86,7 @@ public class ServerConfiguration extends
     protected final static String DISK_USAGE_WARN_THRESHOLD = "diskUsageWarnThreshold";
     protected final static String DISK_CHECK_INTERVAL = "diskCheckInterval";
     protected final static String AUDITOR_PERIODIC_CHECK_INTERVAL = "auditorPeriodicCheckInterval";
+    protected final static String AUDITOR_PERIODIC_BOOKIE_CHECK_INTERVAL = "auditorPeriodicBookieCheckInterval";
     protected final static String AUTO_RECOVERY_DAEMON_ENABLED = "autoRecoveryDaemonEnabled";
 
     // Worker Thread parameters.
@@ -1162,6 +1163,29 @@ public class ServerConfiguration extends
     }
 
     /**
+     * Set the interval between auditor bookie checks.
+     * The auditor bookie check, checks ledger metadata to see which bookies
+     * contain entries for each ledger. If a bookie which should contain entries
+     * is unavailable, then the ledger containing that entry is marked for recovery.
+     * Setting this to 0 disabled the periodic check. Bookie checks will still
+     * run when a bookie fails.
+     *
+     * @param interval The period in seconds.
+     */
+    public void setAuditorPeriodicBookieCheckInterval(long interval) {
+        setProperty(AUDITOR_PERIODIC_BOOKIE_CHECK_INTERVAL, interval);
+    }
+
+    /**
+     * Get the interval between auditor bookie check runs.
+     * @see #setAuditorPeriodicBookieCheckInterval(long)
+     * @return the interval between bookie check runs, in seconds. Default is 84600 (= 1
day)
+     */
+    public long getAuditorPeriodicBookieCheckInterval() {
+        return getLong(AUDITOR_PERIODIC_BOOKIE_CHECK_INTERVAL, 84600);
+    }
+
+    /**
      * Sets that whether the auto-recovery service can start along with Bookie
      * server itself or not
      *

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java?rev=1592705&r1=1592704&r2=1592705&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
Tue May  6 10:30:54 2014
@@ -195,8 +195,10 @@ public class Auditor implements BookiesL
             }
 
             long interval = conf.getAuditorPeriodicCheckInterval();
+
             if (interval > 0) {
-                LOG.info("Periodic checking enabled");
+                LOG.info("Auditor periodic ledger checking enabled"
+                         + " 'auditorPeriodicCheckInterval' {} seconds", interval);
                 executor.scheduleAtFixedRate(new Runnable() {
                         public void run() {
                             LOG.info("Running periodic check");
@@ -229,7 +231,7 @@ public class Auditor implements BookiesL
                 LOG.info("Periodic checking disabled");
             }
 
-            executor.submit(new Runnable() {
+            Runnable bookieCheck = new Runnable() {
                     public void run() {
                         try {
                             knownBookies = getAvailableBookies();
@@ -249,7 +251,17 @@ public class Auditor implements BookiesL
                             submitShutdownTask();
                         }
                     }
-                });
+                };
+
+            long bookieCheckInterval = conf.getAuditorPeriodicBookieCheckInterval();
+            if (bookieCheckInterval == 0) {
+                LOG.info("Auditor periodic bookie checking disabled, running once check now
anyhow");
+                executor.submit(bookieCheck);
+            } else {
+                LOG.info("Auditor periodic bookie checking enabled"
+                         + " 'auditorPeriodicBookieCheckInterval' {} seconds", bookieCheckInterval);
+                executor.scheduleAtFixedRate(bookieCheck, 0, bookieCheckInterval, TimeUnit.SECONDS);
+            }
         }
     }
 



Mime
View raw message