Navigation Menu

Skip to content

Commit

Permalink
Wait until remaining node is completely restarted
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 21, 2015
1 parent f8d565c commit 1e7c429
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bin/droonga-engine-unjoin
Expand Up @@ -122,6 +122,11 @@ module Droonga
@remaining_node ||= detect_remaining_node
end

def remaining_node_serf
@remaining_node_serf ||= Serf.new(remaining_node,
:verbose => @options[:verbose])
end

def detect_remaining_node
generator = Catalog::Generator.new
generator.load(raw_catalog)
Expand All @@ -139,18 +144,15 @@ module Droonga
"#{remaining_host}:#{port}/#{tag}"
end

def run_remote_command(target, command, options)
serf = Serf.new(target, :verbose => @options[:verbose])
serf.send_query(command, options)
end

def do_unjoin
puts "Unjoining replica from the cluster..."

run_remote_command(remaining_node, "unjoin",
remaining_node_serf.ensure_restarted do
remaining_node_serf.send_query("unjoin",
"cluster_id" => cluster_id,
"dataset" => dataset_name,
"hosts" => [replica_remove_host])
end
end
end
end
Expand Down

0 comments on commit 1e7c429

Please sign in to comment.