Kouhei Sutou
null+****@clear*****
Sat Jul 19 16:12:07 JST 2014
Kouhei Sutou 2014-07-19 16:12:07 +0900 (Sat, 19 Jul 2014) New Revision: cb5e7336ad54cc9f5d1e298b9ae608fed517d08a https://github.com/droonga/droonga-engine/commit/cb5e7336ad54cc9f5d1e298b9ae608fed517d08a Message: Support dynamic cluster change in merger Now, you can stop a Droonga engine while loading data. The stopped Droonga engine can receive messages while the stopped Droonga engine starts again. Modified files: lib/droonga/dispatcher.rb lib/droonga/engine_state.rb Modified: lib/droonga/dispatcher.rb (+2 -1) =================================================================== --- lib/droonga/dispatcher.rb 2014-07-19 16:05:09 +0900 (543633f) +++ lib/droonga/dispatcher.rb 2014-07-19 16:12:07 +0900 (f79ce6a) @@ -328,7 +328,8 @@ module Droonga (step["outputs"] || []).each do |output| descendants[output] = [] @descendants[output].each do |index| - @steps[index]["n_of_expects"] += step["routes"].size + live_routes = @engine_state.remove_dead_routes(step["routes"]) + @steps[index]["n_of_expects"] += live_routes.size descendants[output].concat(@steps[index]["routes"]) end end Modified: lib/droonga/engine_state.rb (+5 -4) =================================================================== --- lib/droonga/engine_state.rb 2014-07-19 16:05:09 +0900 (2d3861b) +++ lib/droonga/engine_state.rb 2014-07-19 16:12:07 +0900 (8b78288) @@ -33,7 +33,6 @@ module Droonga attr_reader :replier attr_accessor :on_finish attr_accessor :catalog - attr_writer :dead_nodes def initialize(loop, name, internal_name) @loop = loop @name = name @@ -46,7 +45,7 @@ module Droonga @on_finish = nil @catalog = nil @live_nodes = nil - @dead_nodes = nil + @dead_nodes = [] end def start @@ -119,8 +118,10 @@ module Droonga @live_nodes end - def dead_nodes - @dead_nodes || [] + def remove_dead_routes(routes) + routes.reject do |route| + @dead_nodes.include?(farm_path(route)) + end end private -------------- next part -------------- HTML����������������������������...Download