Navigation Menu

Skip to content

Commit

Permalink
Update catalog correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 28, 2014
1 parent b5c2679 commit 8c45c65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/droonga/command/serf_event_handler.rb
Expand Up @@ -144,16 +144,16 @@ def join_as_replica
puts "joining to the cluster: update myself"

modify_catalog do |modifier|
modifier.datasets[dataset].replicas.hosts += other_hosts
modifier.datasets[dataset].replicas.hosts.uniq!
modifier.datasets[dataset_name].replicas.hosts += other_hosts
modifier.datasets[dataset_name].replicas.hosts.uniq!
end
sleep(1) # wait for restart

puts "joining to the cluster: update others"

source_node = "#{source}:#{port}/#{tag}"
Serf.send_query(source_node, "add_replicas",
"dataset" => dataset,
"dataset" => dataset_name,
"hosts" => [host])
end

Expand Down Expand Up @@ -203,7 +203,7 @@ def remove_replica
def modify_catalog
generator = create_current_catalog_generator
yield(generator)
SafeFileWriter.write(Path.catalog, JSON.pretty_generate(generator.catalog))
SafeFileWriter.write(Path.catalog, JSON.pretty_generate(generator.generate))
end

def create_current_catalog_generator
Expand Down

0 comments on commit 8c45c65

Please sign in to comment.