[Groonga-commit] droonga/droonga-engine at 8d2679c [master] Restart Serf agent always, if the catalog.json is modified

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Sun Nov 30 02:33:23 JST 2014


YUKI Hiroshi	2014-11-30 02:33:23 +0900 (Sun, 30 Nov 2014)

  New Revision: 8d2679c70c56cd986e581e0b04ba4b7ae2eb3e3e
  https://github.com/droonga/droonga-engine/commit/8d2679c70c56cd986e581e0b04ba4b7ae2eb3e3e

  Message:
    Restart Serf agent always, if the catalog.json is modified

  Modified files:
    bin/droonga-engine-unjoin
    lib/droonga/command/droonga_engine.rb
    lib/droonga/command/remote.rb
    lib/droonga/command/serf_event_handler.rb
    lib/droonga/serf.rb

  Modified: bin/droonga-engine-unjoin (+0 -5)
===================================================================
--- bin/droonga-engine-unjoin    2014-11-30 01:26:52 +0900 (6001338)
+++ bin/droonga-engine-unjoin    2014-11-30 02:33:23 +0900 (4529239)
@@ -134,11 +134,6 @@ class UnjoinCommand
                        "node"    => replica_remove_node,
                        "dataset" => dataset_name,
                        "hosts"   => [replica_remove_host])
-    # It must be restarted to be removed from the Serf cluster.
-    # Otherwise protocol adapters unexpectedly tries to connect
-    # to the unjoined node.
-    run_remote_command(replica_remove_node, "restart_serf_agent",
-                       "node"    => replica_remove_node)
   end
 end
 

  Modified: lib/droonga/command/droonga_engine.rb (+1 -0)
===================================================================
--- lib/droonga/command/droonga_engine.rb    2014-11-30 01:26:52 +0900 (70abe9b)
+++ lib/droonga/command/droonga_engine.rb    2014-11-30 02:33:23 +0900 (6bc677d)
@@ -382,6 +382,7 @@ module Droonga
           catalog_observer = FileObserver.new(@loop, Path.catalog)
           catalog_observer.on_change = lambda do
             restart_graceful
+            @serf.restart if @serf and****@serf*****?
           end
           catalog_observer.start
           catalog_observer

  Modified: lib/droonga/command/remote.rb (+0 -11)
===================================================================
--- lib/droonga/command/remote.rb    2014-11-30 01:26:52 +0900 (a67612e)
+++ lib/droonga/command/remote.rb    2014-11-30 02:33:23 +0900 (1caede3)
@@ -14,7 +14,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 require "json"
-require "fileutils"
 
 require "droonga/path"
 require "droonga/serf"
@@ -328,7 +327,6 @@ module Droonga
           end
 
           @serf.join(*hosts)
-          #XXX Now we should restart serf agent to remove unjoined nodes from the list of members...
         end
       end
 
@@ -360,8 +358,6 @@ module Droonga
             modifier.datasets[dataset].replicas.hosts -= hosts
             @service_installation.ensure_correct_file_permission(file)
           end
-
-          #XXX Now we should restart serf agent to remove unjoined nodes from the list of members...
         end
       end
 
@@ -381,13 +377,6 @@ module Droonga
           @serf.live_nodes
         end
       end
-
-      class RestartSerfAgent < Base
-        def process
-          FileUtils.mkdir_p(Serf.restart_file.parent)
-          FileUtils.touch(Serf.restart_file)
-        end
-      end
     end
   end
 end

  Modified: lib/droonga/command/serf_event_handler.rb (+0 -2)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2014-11-30 01:26:52 +0900 (281ec69)
+++ lib/droonga/command/serf_event_handler.rb    2014-11-30 02:33:23 +0900 (d13a997)
@@ -85,8 +85,6 @@ module Droonga
           Remote::RemoveReplicas
         when "absorb_data"
           Remote::AbsorbData
-        when "restart_serf_agent"
-          Remote::RestartSerfAgent
         else
           nil
         end

  Modified: lib/droonga/serf.rb (+0 -18)
===================================================================
--- lib/droonga/serf.rb    2014-11-30 01:26:52 +0900 (a03e63b)
+++ lib/droonga/serf.rb    2014-11-30 02:33:23 +0900 (b806c3b)
@@ -18,7 +18,6 @@ require "English"
 require "json"
 require "coolio"
 require "open3"
-require "fileutils"
 
 require "droonga/path"
 require "droonga/loggable"
@@ -26,7 +25,6 @@ require "droonga/catalog_loader"
 require "droonga/node_status"
 require "droonga/serf_downloader"
 require "droonga/line_buffer"
-require "droonga/file_observer"
 
 module Droonga
   class Serf
@@ -46,10 +44,6 @@ module Droonga
       def path
         Droonga::Path.base + "serf"
       end
-
-      def restart_file
-        Droonga::Path.state + "restart_serf"
-      end
     end
 
     include Loggable
@@ -78,16 +72,6 @@ module Droonga
                    "-log-level", log_level,
                    "-tag", "role=engine",
                    *retry_joins)
-
-      FileUtils.mkdir_p(self.class.restart_file.parent)
-      FileUtils.touch(self.class.restart_file)
-
-      @restart_file_observer = FileObserver.new(@loop, self.class.restart_file)
-      @restart_file_observer.on_change = lambda do
-        restart
-      end
-      @restart_file_observer.start
-
       logger.trace("start: done")
     end
 
@@ -98,8 +82,6 @@ module Droonga
     def stop
       logger.trace("stop: start")
       run("leave").stop
-      @restart_file_observer.stop
-      @restart_file_observer = nil
       @agent.stop
       @agent = nil
       logger.trace("stop: done")
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る