YUKI Hiroshi
null+****@clear*****
Wed Apr 1 15:49:33 JST 2015
YUKI Hiroshi 2015-04-01 15:49:33 +0900 (Wed, 01 Apr 2015) New Revision: 96cb1f13e7c8d838454cfc9712dcd2915174b704 https://github.com/droonga/droonga-engine/commit/96cb1f13e7c8d838454cfc9712dcd2915174b704 Message: Set "have-unprocessed-messages-for-*" tag while there is any write buffer for the node Modified files: lib/droonga/command/droonga_engine.rb lib/droonga/forward_buffer.rb lib/droonga/serf.rb Modified: lib/droonga/command/droonga_engine.rb (+1 -0) =================================================================== --- lib/droonga/command/droonga_engine.rb 2015-04-01 15:40:47 +0900 (9b0f083) +++ lib/droonga/command/droonga_engine.rb 2015-04-01 15:49:33 +0900 (31b5c0f) @@ -372,6 +372,7 @@ module Droonga def initialize(configuration) @configuration = configuration + ENV["DROONGA_ENGINE_NAME"] =****@confi***** @loop = Coolio::Loop.default @log_file = nil @pid_file_path = nil Modified: lib/droonga/forward_buffer.rb (+6 -0) =================================================================== --- lib/droonga/forward_buffer.rb 2015-04-01 15:40:47 +0900 (bd7cd97) +++ lib/droonga/forward_buffer.rb 2015-04-01 15:49:33 +0900 (69d5ed3) @@ -22,6 +22,7 @@ require "msgpack" require "droonga/loggable" require "droonga/path" require "droonga/safe_file_writer" +require "droonga/serf" module Droonga class ForwardBuffer @@ -37,6 +38,9 @@ module Droonga @packer = MessagePack::Packer.new @unpacker = MessagePack::Unpacker.new + @target = node_name + @serf = Serf.new(ENV["DROONGA_ENGINE_NAME"]) + dirname = node_name.gsub("/", ":") @data_directory = Path.intentional_buffer + dirname FileUtils.mkdir_p(@data_directory.to_s) @@ -44,6 +48,7 @@ module Droonga def add(message, destination) logger.trace("add: start") + @serf.set_have_unprocessed_messages_for(@target) buffered_message = { "message" => message, "destination" => destination, @@ -61,6 +66,7 @@ module Droonga Pathname.glob("#{@data_directory}/*#{SUFFIX}").collect do |buffered_message_path| forward(buffered_message_path) end + @serf.reset_have_unprocessed_messages_for(@target) logger.trace("start_forward: done") end Modified: lib/droonga/serf.rb (+8 -0) =================================================================== --- lib/droonga/serf.rb 2015-04-01 15:40:47 +0900 (7417af2) +++ lib/droonga/serf.rb 2015-04-01 15:49:33 +0900 (c6a9476) @@ -141,6 +141,14 @@ module Droonga set_tag("cluster_id", cluster_id) end + def set_have_unprocessed_messages_for(node_name) + set_tag("have-unprocessed-messages-for-#{node-name}", true) + end + + def reset_have_unprocessed_messages_for(node_name) + delete_tag("have-unprocessed-messages-for-#{node-name}") + end + def role @node_metadata.reload @node_metadata.role -------------- next part -------------- HTML����������������������������...Download