Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add --fast option to the reload command.
  • Loading branch information
hyungoo committed Mar 15, 2012
1 parent ece277f commit 4ddb144
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
21 changes: 5 additions & 16 deletions lib/gizzard/commands.rb
Expand Up @@ -238,22 +238,11 @@ def down(id, depth = 0)
class ReloadCommand < Command
def run
if global_options.force || ask
manager.reload_config
else
STDERR.puts "aborted"
end
end

def ask
output "Are you sure? Reloading will affect production services immediately! (Type 'yes')"
gets.chomp == "yes"
end
end

class ReloadUpdatedCommand < Command
def run
if global_options.force || ask
manager.reload_updated_forwardings
if command_options.fast
manager.reload_updated_forwardings
else
manager.reload_config
end
else
STDERR.puts "aborted"
end
Expand Down
12 changes: 6 additions & 6 deletions lib/gizzmo.rb
Expand Up @@ -38,7 +38,6 @@ class HelpNeededError < RuntimeError; end
"ping" => "Confirm that all configured application servers are accessible, and in agreement about the set of shard hosts.",
"rebalance" => "Restructure and move shards to reflect a new list of tree structures.",
"reload" => "Instruct application servers to reload the nameserver state.",
"reload-updated" => "Instruct application servers to partially reload the nameserver state - only the entries that have been updated since the last reload.",
"remove-host" => "Remove a remote cluster host being replicate to.",
"remove-partition" => "Rebalance the cluster by removing the provided partitions from the current topology.",
"repair-tables" => "Reconcile all the shards in the given tables (supplied with -T) by detecting differences and writing them back to shards as needed.",
Expand Down Expand Up @@ -278,14 +277,15 @@ def add_template_opts(subcommand_options, opts)
opts.banner = "Usage: #{zero} info SHARD_ID [MORE SHARD_IDS...]"
separators(opts, DOC_STRINGS["info"])
end,

'reload' => OptionParser.new do |opts|
opts.banner = "Usage: #{zero} reload"
opts.banner = "Usage: #{zero} reload [--fast]"
separators(opts, DOC_STRINGS["reload"])
opts.on("--fast", "Reload only the entries that have been updated since the last reload.") do
subcommand_options.fast = true
end
end,
'reload-updated' => OptionParser.new do |opts|
opts.banner = "Usage: #{zero} reload-updated"
separators(opts, DOC_STRINGS["reload-updated"])
end,

'drill' => OptionParser.new do |opts|
opts.banner = "Usage: #{zero} drill SIGNATURE"
separators(opts, DOC_STRINGS["drill"])
Expand Down

0 comments on commit 4ddb144

Please sign in to comment.