[Groonga-commit] droonga/droonga-engine at 6cf151c [master] Report error if there is no node to dispatch a message

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Jan 15 15:52:22 JST 2015


YUKI Hiroshi	2015-01-15 15:52:22 +0900 (Thu, 15 Jan 2015)

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

  Message:
    Report error if there is no node to dispatch a message

  Modified files:
    lib/droonga/dispatcher.rb
    lib/droonga/engine_node.rb
    lib/droonga/engine_state.rb

  Modified: lib/droonga/dispatcher.rb (+10 -0)
===================================================================
--- lib/droonga/dispatcher.rb    2015-01-15 15:34:55 +0900 (88358fb)
+++ lib/droonga/dispatcher.rb    2015-01-15 15:52:22 +0900 (da5f69c)
@@ -203,8 +203,18 @@ module Droonga
         if dataset
           if write_step?(step)
             target_nodes =****@clust*****_nodes
+            if target_nodes.empty?
+              logger.error("there is no node to dispath a write message!",
+                           :my_role   => @engine_state.role,
+                           :all_nodes => @cluster.engine_nodes(&:to_json))
+            end
           else
             target_nodes =****@clust*****_nodes
+            if target_nodes.empty?
+              logger.error("there is no node to dispath a read message!",
+                           :my_role   => @engine_state.role,
+                           :all_nodes => @cluster.engine_nodes(&:to_json))
+            end
           end
           routes = dataset.compute_routes(step, target_nodes)
           step["routes"] = routes

  Modified: lib/droonga/engine_node.rb (+8 -0)
===================================================================
--- lib/droonga/engine_node.rb    2015-01-15 15:34:55 +0900 (f0dbb24)
+++ lib/droonga/engine_node.rb    2015-01-15 15:52:22 +0900 (c07f3a7)
@@ -80,6 +80,14 @@ module Droonga
       end
     end
 
+    def to_json
+      {
+        "name"   => name,
+        "role"   => role,
+        "status" => status
+      }
+    end
+
     def on_change
       @sender.resume
     end

  Modified: lib/droonga/engine_state.rb (+9 -0)
===================================================================
--- lib/droonga/engine_state.rb    2015-01-15 15:34:55 +0900 (9ebc453)
+++ lib/droonga/engine_state.rb    2015-01-15 15:52:22 +0900 (bb21f23)
@@ -21,6 +21,7 @@ require "droonga/loggable"
 require "droonga/event_loop"
 require "droonga/forwarder"
 require "droonga/replier"
+require "droonga/node_metadata"
 
 module Droonga
   class EngineState
@@ -104,11 +105,19 @@ module Droonga
       not****@sessi*****?
     end
 
+    def role
+      node_metadata.role
+    end
+
     def on_ready
       @on_ready.call if @on_ready
     end
 
     private
+    def node_metadata
+      @node_metadata ||= NodeMetadata.new
+    end
+
     def log_tag
       "engine_state"
     end
-------------- next part --------------
HTML����������������������������...
Download 



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