[Groonga-commit] droonga/droonga-engine at 11752c8 [master] Detect list of live nodes based on the catalog and list of dead nodes.

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Dec 11 18:43:59 JST 2014


YUKI Hiroshi	2014-12-11 18:43:59 +0900 (Thu, 11 Dec 2014)

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

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

  Message:
    Detect list of live nodes based on the catalog and list of dead nodes.
    
    To send messages to temporary unjoined nodes (as a source for newly joined node), we must ignore
    difference of cluster_id

  Modified files:
    lib/droonga/engine_state.rb
    lib/droonga/live_nodes_list.rb
    test/unit/plugins/system/test_status.rb

  Modified: lib/droonga/engine_state.rb (+8 -4)
===================================================================
--- lib/droonga/engine_state.rb    2014-12-11 18:34:42 +0900 (5b2287d)
+++ lib/droonga/engine_state.rb    2014-12-11 18:43:59 +0900 (9bffd23)
@@ -114,18 +114,22 @@ module Droonga
     #  * read-write messages : deliver
     #  * responses           : returned
     def active_nodes
-      live_nodes - suspended_nodes
+      all_nodes - dead_nodes - suspended_nodes
     end
 
-    # nodes in the serf cluster
+    # nodes in the cluster
     #  * read-only messages  : deliver
     #  * read-write messages : deliver
     #  * responses           : undetermined
     def live_nodes
+      all_nodes - dead_nodes
+    end
+
+    def dead_nodes
       if @live_nodes_list
-        @live_nodes_list.live_nodes
+        @live_nodes_list.dead_nodes
       else
-        all_nodes
+        []
       end
     end
 

  Modified: lib/droonga/live_nodes_list.rb (+4 -4)
===================================================================
--- lib/droonga/live_nodes_list.rb    2014-12-11 18:34:42 +0900 (c3ec720)
+++ lib/droonga/live_nodes_list.rb    2014-12-11 18:43:59 +0900 (cb05762)
@@ -23,8 +23,8 @@ module Droonga
       @nodes.keys
     end
 
-    def live_nodes
-      @live_nodes ||= collect_live_nodes
+    def dead_nodes
+      @dead_nodes ||= collect_dead_nodes
     end
 
     def suspended_nodes
@@ -32,10 +32,10 @@ module Droonga
     end
 
     private
-    def collect_live_nodes
+    def collect_dead_nodes
       nodes = []
       @nodes.each do |name, state|
-        if not state["foreign"] and state["live"]
+        unless state["live"]
           nodes << name
         end
       end

  Modified: test/unit/plugins/system/test_status.rb (+7 -1)
===================================================================
--- test/unit/plugins/system/test_status.rb    2014-12-11 18:34:42 +0900 (7eb671e)
+++ test/unit/plugins/system/test_status.rb    2014-12-11 18:43:59 +0900 (eb652fd)
@@ -54,7 +54,7 @@ class SystemStatusHandlerTest < Test::Unit::TestCase
       ]
     end
 
-    def live_nodes
+    def active_nodes
       [
         "127.0.0.1:10031/droonga",
       ]
@@ -65,6 +65,12 @@ class SystemStatusHandlerTest < Test::Unit::TestCase
         "127.0.0.1:10032/droonga",
       ]
     end
+
+    def dead_nodes
+      [
+        "127.0.0.1:10033/droonga",
+      ]
+    end
   end
 
   public
-------------- next part --------------
HTML����������������������������...
Télécharger 



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