YUKI Hiroshi
null+****@clear*****
Sun Nov 30 10:49:38 JST 2014
YUKI Hiroshi 2014-11-30 10:49:38 +0900 (Sun, 30 Nov 2014) New Revision: b2a9ff12a77e303f86b38922b0829ca37372dfde https://github.com/droonga/droonga-engine/commit/b2a9ff12a77e303f86b38922b0829ca37372dfde Message: Use specific "unjoin" command to remove hosts from the cluster Modified files: bin/droonga-engine-unjoin lib/droonga/command/remote.rb lib/droonga/command/serf_event_handler.rb Modified: bin/droonga-engine-unjoin (+1 -6) =================================================================== --- bin/droonga-engine-unjoin 2014-11-30 04:44:05 +0900 (4529239) +++ bin/droonga-engine-unjoin 2014-11-30 10:49:38 +0900 (7535ad3) @@ -126,12 +126,7 @@ class UnjoinCommand def do_unjoin puts "Unjoining replica from the cluster..." - run_remote_command(remaining_node, "remove_replicas", - "dataset" => dataset_name, - "hosts" => [replica_remove_host]) - - run_remote_command(replica_remove_node, "set_replicas", - "node" => replica_remove_node, + run_remote_command(remaining_node, "unjoin", "dataset" => dataset_name, "hosts" => [replica_remove_host]) end Modified: lib/droonga/command/remote.rb (+22 -0) =================================================================== --- lib/droonga/command/remote.rb 2014-11-30 04:44:05 +0900 (1caede3) +++ lib/droonga/command/remote.rb 2014-11-30 10:49:38 +0900 (cf7569b) @@ -238,6 +238,28 @@ module Droonga end end + class Unjoin < Base + def process + return if dataset.nil? or hosts.nil? + + log("unjoining replicas: #{hosts.join(",")}") + + CatalogModifier.modify do |modifier, file| + if unjoining_node? + modifier.datasets[dataset].replicas.hosts = hosts + else + modifier.datasets[dataset].replicas.hosts -= hosts + end + @service_installation.ensure_correct_file_permission(file) + end + end + + private + def unjoining_node? + hosts.include?(host) + end + end + class AbsorbData < Base attr_writer :dataset_name, :port, :tag Modified: lib/droonga/command/serf_event_handler.rb (+2 -0) =================================================================== --- lib/droonga/command/serf_event_handler.rb 2014-11-30 04:44:05 +0900 (d13a997) +++ lib/droonga/command/serf_event_handler.rb 2014-11-30 10:49:38 +0900 (4635e98) @@ -77,6 +77,8 @@ module Droonga Remote::SetStatus when "join" Remote::Join + when "unjoin" + Remote::Unjoin when "set_replicas" Remote::SetReplicas when "add_replicas" -------------- next part -------------- HTML����������������������������...Download