YUKI Hiroshi
null+****@clear*****
Wed Dec 24 18:19:40 JST 2014
YUKI Hiroshi 2014-12-24 18:19:40 +0900 (Wed, 24 Dec 2014) New Revision: 9b464496e30a06db6681c5e662dff1713fa37bcc https://github.com/droonga/droonga-engine/commit/9b464496e30a06db6681c5e662dff1713fa37bcc Message: Update live-nodes-list on the startup. The serf agent updates the list at first. After that, the engine loads the list. Modified files: lib/droonga/command/remote.rb lib/droonga/engine.rb lib/droonga/serf.rb Modified: lib/droonga/command/remote.rb (+1 -12) =================================================================== --- lib/droonga/command/remote.rb 2014-12-24 17:07:12 +0900 (5726cdc) +++ lib/droonga/command/remote.rb 2014-12-24 18:19:40 +0900 (dec9e97) @@ -397,18 +397,7 @@ module Droonga class UpdateLiveNodesList < Base def process - path = Path.live_nodes_list - new_list = live_nodes_list - file_contents = JSON.pretty_generate(new_list) - SafeFileWriter.write(path) do |output, file| - output.puts(file_contents) - @service_installation.ensure_correct_file_permission(file) - end - end - - private - def live_nodes_list - @serf.live_nodes_list + @serf.update_live_nodes_list end end end Modified: lib/droonga/engine.rb (+1 -0) =================================================================== --- lib/droonga/engine.rb 2014-12-24 17:07:12 +0900 (b0e5dcf) +++ lib/droonga/engine.rb 2014-12-24 18:19:40 +0900 (ec9047f) @@ -33,6 +33,7 @@ module Droonga attr_writer :on_ready def initialize(loop, name, internal_name) @state = EngineState.new(loop, name, internal_name) + @state.live_nodes_list = load_live_nodes_list @catalog = load_catalog @state.catalog = @catalog @dispatcher = create_dispatcher Modified: lib/droonga/serf.rb (+14 -0) =================================================================== --- lib/droonga/serf.rb 2014-12-24 17:07:12 +0900 (6491cb2) +++ lib/droonga/serf.rb 2014-12-24 18:19:40 +0900 (1c50c04) @@ -25,6 +25,8 @@ require "droonga/catalog_loader" require "droonga/node_status" require "droonga/serf_downloader" require "droonga/line_buffer" +require "droonga/safe_file_writer" +require "droonga/service_installation" module Droonga class Serf @@ -45,6 +47,7 @@ module Droonga @loop = loop @name = name @agent = nil + @service_installation = ServiceInstallation.new end def start @@ -64,6 +67,7 @@ module Droonga "-tag", "role=#{role}", "-tag", "cluster_id=#{cluster_id}", *retry_joins) + update_live_nodes_list logger.trace("start: done") end @@ -116,6 +120,16 @@ module Droonga result end + def update_live_nodes_list + path = Path.live_nodes_list + new_list = live_nodes_list + file_contents = JSON.pretty_generate(new_list) + SafeFileWriter.write(path) do |output, file| + output.puts(file_contents) + @service_installation.ensure_correct_file_permission(file) + end + end + def live_nodes_list ensure_serf nodes_list = {} -------------- next part -------------- HTML����������������������������... 다운로드