[Groonga-commit] droonga/droonga-engine at ef8ff1a [master] Close old internal connections to myself via EngineNode must be closed before graceful stop of Engine service

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 22 19:15:57 JST 2015


YUKI Hiroshi	2015-04-22 19:15:57 +0900 (Wed, 22 Apr 2015)

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

  Message:
    Close old internal connections to myself via EngineNode must be closed before graceful stop of Engine service

  Modified files:
    lib/droonga/command/droonga_engine_service.rb
    lib/droonga/engine.rb
    lib/droonga/fluent_message_receiver.rb

  Modified: lib/droonga/command/droonga_engine_service.rb (+7 -1)
===================================================================
--- lib/droonga/command/droonga_engine_service.rb    2015-04-22 19:15:37 +0900 (73cdf94)
+++ lib/droonga/command/droonga_engine_service.rb    2015-04-22 19:15:57 +0900 (6e654a7)
@@ -213,7 +213,13 @@ module Droonga
         return if @stopping
         logger.trace("stop_gracefully: start")
         @stopping = true
-        @receiver.stop_gracefully do
+        @receiver.stop_gracefully
+        #XXX To disconnect all clients to myself (old service),
+        #    we must refresh all connections via EngineNode.
+        @engine.cluster.refresh_connections
+        #XXX However, internal connections via Forwarder can be
+        #    still there. Then we have to wait for their timeout.
+        @receiver.ensure_no_client do
           logger.trace("stop_gracefully: ready to stop service")
           @engine.stop_gracefully do
             logger.trace("stop_gracefully: ready to stop workers")

  Modified: lib/droonga/engine.rb (+2 -0)
===================================================================
--- lib/droonga/engine.rb    2015-04-22 19:15:37 +0900 (08127a5)
+++ lib/droonga/engine.rb    2015-04-22 19:15:57 +0900 (bb781a2)
@@ -32,6 +32,8 @@ module Droonga
     include Loggable
     include Deferrable
 
+    attr_reader :cluster
+
     def initialize(loop, name, internal_name)
       @name = name
       @internal_name = internal_name

  Modified: lib/droonga/fluent_message_receiver.rb (+9 -5)
===================================================================
--- lib/droonga/fluent_message_receiver.rb    2015-04-22 19:15:37 +0900 (18158c2)
+++ lib/droonga/fluent_message_receiver.rb    2015-04-22 19:15:57 +0900 (43a463d)
@@ -41,22 +41,26 @@ module Droonga
       logger.trace("start: done")
     end
 
-    def stop_gracefully(&block)
+    def stop_gracefully
       logger.trace("stop_gracefully: start")
       shutdown_heartbeat_receiver
       logger.trace("stop_gracefully: middle")
       shutdown_server
+      logger.trace("stop_gracefully: done")
+    end
+
+    def ensure_no_client(&block)
       if****@clien*****?
-        logger.trace("stop_gracefully: no connecting client")
+        logger.trace("ensure_no_client: no client")
         yield
       elsif block_given?
-        logger.trace("stop_gracefully: waiting for #{@clients.size} clients to be disconnected")
+        logger.trace("ensure_no_client: waiting for #{@clients.size} clients to be disconnected",
+                     :clients => @clients)
         @on_shutdown_ready = lambda do
-          logger.trace("stop_gracefully: all clients are disconnected")
+          logger.trace("ensure_no_client: all clients are disconnected")
           yield
         end
       end
-      logger.trace("stop_gracefully: done")
     end
 
     def stop_immediately
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index