hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-14529 Respond to SIGHUP to reload config
Date Thu, 08 Oct 2015 23:38:45 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 18015e0fd -> 213b6f2f6


HBASE-14529 Respond to SIGHUP to reload config

Summary: Add a signal handler to reload the config.

Test Plan: Send the command and see that configs get reloaded.

Differential Revision: https://reviews.facebook.net/D47877


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/213b6f2f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/213b6f2f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/213b6f2f

Branch: refs/heads/branch-1.2
Commit: 213b6f2f6d0fc720349a4dc2ab34ad94f44c753a
Parents: 18015e0
Author: Elliott Clark <eclark@apache.org>
Authored: Wed Sep 30 15:30:15 2015 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Thu Oct 8 16:38:37 2015 -0700

----------------------------------------------------------------------
 bin/hbase-daemon.sh                                         | 3 ++-
 .../org/apache/hadoop/hbase/conf/ConfigurationManager.java  | 1 +
 .../org/apache/hadoop/hbase/regionserver/HRegionServer.java | 9 +++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/213b6f2f/bin/hbase-daemon.sh
----------------------------------------------------------------------
diff --git a/bin/hbase-daemon.sh b/bin/hbase-daemon.sh
index 673e25a..6f0a524 100755
--- a/bin/hbase-daemon.sh
+++ b/bin/hbase-daemon.sh
@@ -186,8 +186,9 @@ case $startStop in
     hbase_rotate_log $HBASE_LOGOUT
     hbase_rotate_log $HBASE_LOGGC
     echo starting $command, logging to $HBASE_LOGOUT
-    nohup $thiscmd --config "${HBASE_CONF_DIR}" \
+    $thiscmd --config "${HBASE_CONF_DIR}" \
         foreground_start $command $args < /dev/null > ${HBASE_LOGOUT} 2>&1 
&
+    disown -h -r
     sleep 1; head "${HBASE_LOGOUT}"
   ;;
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/213b6f2f/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java
index 29b3e8b..1701588 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java
@@ -114,6 +114,7 @@ public class ConfigurationManager {
    * all the observers that are expressed interest to do that.
    */
   public void notifyAllObservers(Configuration conf) {
+    LOG.info("Starting to notify all observers that config changed.");
     synchronized (configurationObservers) {
       for (ConfigurationObserver observer : configurationObservers) {
         try {

http://git-wip-us.apache.org/repos/asf/hbase/blob/213b6f2f/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index dd76868..b58fb8f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -187,6 +187,8 @@ import com.google.protobuf.RpcCallback;
 import com.google.protobuf.RpcController;
 import com.google.protobuf.Service;
 import com.google.protobuf.ServiceException;
+import sun.misc.Signal;
+import sun.misc.SignalHandler;
 
 /**
  * HRegionServer makes a set of HRegions available to clients. It checks in with
@@ -599,6 +601,13 @@ public class HRegionServer extends HasThread implements
     putUpWebUI();
     this.walRoller = new LogRoller(this, this);
     this.choreService = new ChoreService(getServerName().toString());
+
+    Signal.handle(new Signal("HUP"), new SignalHandler() {
+      public void handle(Signal signal) {
+        getConfiguration().reloadConfiguration();
+        configurationManager.notifyAllObservers(getConfiguration());
+      }
+    });
   }
 
   /*


Mime
View raw message