[Groonga-commit] droonga/droonga-engine at 49723d9 [master] Don't deliver messages to suspended nodes

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Dec 11 18:16:39 JST 2014


YUKI Hiroshi	2014-12-11 18:16:39 +0900 (Thu, 11 Dec 2014)

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

  Merged 97ba0d9: Merge ../droonga-engine into replicas-in-a-branch

  Message:
    Don't deliver messages to suspended nodes

  Modified files:
    lib/droonga/dispatcher.rb
    lib/droonga/engine_state.rb
    lib/droonga/plugins/system.rb

  Modified: lib/droonga/dispatcher.rb (+1 -1)
===================================================================
--- lib/droonga/dispatcher.rb    2014-12-11 18:01:30 +0900 (8bbcec6)
+++ lib/droonga/dispatcher.rb    2014-12-11 18:16:39 +0900 (bae1c6f)
@@ -192,7 +192,7 @@ module Droonga
       steps.each do |step|
         dataset =****@catal*****(step["dataset"])
         if dataset
-          routes = dataset.compute_routes(step, @engine_state.live_nodes)
+          routes = dataset.compute_routes(step, @engine_state.active_nodes)
           step["routes"] = routes
         else
           step["routes"] ||= [id]

  Modified: lib/droonga/engine_state.rb (+17 -0)
===================================================================
--- lib/droonga/engine_state.rb    2014-12-11 18:01:30 +0900 (2f8574d)
+++ lib/droonga/engine_state.rb    2014-12-11 18:16:39 +0900 (9ed3c24)
@@ -109,6 +109,18 @@ module Droonga
       @catalog.all_nodes
     end
 
+    # nodes who provide the service actually
+    #  * read-only messages  : deliver
+    #  * read-write messages : deliver
+    #  * responses           : returned
+    def active_nodes
+      live_nodes - suspended_nodes
+    end
+
+    # nodes in the serf cluster
+    #  * read-only messages  : deliver
+    #  * read-write messages : deliver
+    #  * responses           : undetermined
     def live_nodes
       if @live_nodes_list
         @live_nodes_list.all_nodes
@@ -117,6 +129,11 @@ module Droonga
       end
     end
 
+    # nodes who temporary suspended
+    # (going to join to the cluster, etc,)
+    #  * read-only messages  : don't deliver
+    #  * read-write messages : deliver
+    #  * responses           : not returned
     def suspended_nodes
       if @live_nodes_list
         @live_nodes_list.suspended_nodes

  Modified: lib/droonga/plugins/system.rb (+4 -4)
===================================================================
--- lib/droonga/plugins/system.rb    2014-12-11 18:01:30 +0900 (e8a6a40)
+++ lib/droonga/plugins/system.rb    2014-12-11 18:16:39 +0900 (d6b56a5)
@@ -26,14 +26,14 @@ module Droonga
 
         def handle(message)
           engine_state =****@messe*****_state
-          live_nodes = engine_state.live_nodes
+          active_nodes = engine_state.active_nodes
           suspended_nodes = engine_state.suspended_nodes
           nodes = {}
           engine_state.all_nodes.collect do |identifier|
-            if suspended_nodes.include?(identifier)
-              status = "suspended"
-            elsif live_nodes.include?(identifier)
+            if active_nodes.include?(identifier)
               status = "active"
+            elsif suspended_nodes.include?(identifier)
+              status = "suspended"
             else
               status = "inactive"
             end
-------------- next part --------------
HTML����������������������������...
Download 



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