[Groonga-commit] droonga/droonga-engine at eb090bb [master] Stop serf agent at first on the shutdown process.

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Mon Apr 20 14:04:01 JST 2015


YUKI Hiroshi	2015-04-20 14:04:01 +0900 (Mon, 20 Apr 2015)

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

  Message:
    Stop serf agent at first on the shutdown process.
    
    Otherwise, other nodes can try to send messages to dead engines.

  Modified files:
    lib/droonga/command/droonga_engine.rb

  Modified: lib/droonga/command/droonga_engine.rb (+12 -4)
===================================================================
--- lib/droonga/command/droonga_engine.rb    2015-04-20 14:02:26 +0900 (034d9a8)
+++ lib/droonga/command/droonga_engine.rb    2015-04-20 14:04:01 +0900 (fe9aeb6)
@@ -470,6 +470,9 @@ module Droonga
 
         def stop_gracefully
           logger.trace("stop_gracefully: start")
+          logger.trace("stop_gracefully: stopping serf agent")
+          stop_serf do
+          logger.trace("stop_gracefully: stopping command runner")
           @command_runner.stop
           logger.trace("stop_gracefully: stopping cluster_state_observer")
           @cluster_state_observer.stop
@@ -477,18 +480,20 @@ module Droonga
           @catalog_observer.stop
           logger.trace("stop_gracefully: stopping restart_observer")
           @restart_observer.stop
-          stop_serf
           @service_runner.stop_gracefully
+          logger.trace("stop_gracefully: completely done")
+          end
           logger.trace("stop_gracefully: done")
         end
 
         def stop_immediately
+          stop_serf do
           @command_runner.stop
           @cluster_state_observer.stop
           @catalog_observer.stop
           @restart_observer.stop
-          stop_serf
           @service_runner.stop_immediately
+          end
         end
 
         def restart_graceful
@@ -547,14 +552,17 @@ module Droonga
           @serf_agent =****@serf*****_agent(@loop)
         end
 
-        def stop_serf
+        def stop_serf(&block)
           logger.trace("stop_serf: start")
           begin
             @serf.leave
           rescue Droonga::Serf::Command::Failure
             logger.error("Failed to leave from Serf cluster: #{$!.message}")
           end
-          @serf_agent.stop
+          @serf_agent.stop do
+            logger.trace("stop_serf: serf agent stopped")
+            yield
+          end
           logger.trace("stop_serf: done")
         end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index