You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
method_option:max_id,:desc=>'Maximum ID of parent shard to split'
408
408
method_option:ranges,:desc=>'Optional comma-separated list of ranges per child ie "1000-1999,2000-2499" (default if omitted: split evenly)'
409
409
method_option:count,:desc=>'How many child shards to split the parent into (only necessary if the ranges option is omitted)'
410
+
method_option:shard_pool,:desc=>'The sharding pool for which to perform the split'
410
411
defshard_split
411
412
shard_min=options[:min_id] || ask('Please enter min ID of the parent shard: ')
412
413
shard_max=options[:max_id] || ask('Please enter max ID of the parent shard: ')
413
-
s=Jetpants.topology.shardshard_min,shard_max
414
+
415
+
shard_pool=options[:shard_pool] || ask("Please enter the sharding pool for which to perform the split (enter for default pool, #{Jetpants.topology.default_shard_pool}): ")
shard_pool=options[:shard_pool] || ask("Please enter the sharding pool for which to perform the split (enter for default pool, #{Jetpants.topology.default_shard_pool}): ")
method_option:min_id,:desc=>'Minimum ID of shard involved in master promotion'
582
593
method_option:max_id,:desc=>'Maximum ID of shard involved in master promotion'
583
594
method_option:new_master,:desc=>'New node to become master of the shard'
595
+
method_option:shard_pool,:desc=>'The sharding pool for which to perform the promotion'
584
596
defshard_promote_master
597
+
shard_pool=options[:shard_pool] || ask("Please enter the sharding pool for which to perform the master promotion (enter for default, #{Jetpants.topology.default_shard_pool}): ")
new_master=ask_node"Please enter the IP of the new master for #{s}: ",options[:new_master]
589
603
raise"New master node #{new_master} is not currently a slave in shard #{s}"unlesss.slaves && s.slaves.include?(new_master)
@@ -610,9 +624,12 @@ module Jetpants
610
624
desc'shard_promote_master_reads','Lockless shard master promotion (step 2 of 4): move reads to new master'
611
625
method_option:min_id,:desc=>'Minimum ID of shard involved in master promotion'
612
626
method_option:max_id,:desc=>'Maximum ID of shard involved in master promotion'
627
+
method_option:shard_pool,:desc=>'The sharding pool for which to perform the promotion'
613
628
defshard_promote_master_reads
629
+
shard_pool=options[:shard_pool] || ask("Please enter the sharding pool for which to perform the master promotion (enter for default pool, #{Jetpants.topology.default_shard_pool}): ")
# at this point we only have one slave, which is the new master
618
635
new_master=s.master.slaves.last
@@ -637,8 +654,11 @@ module Jetpants
637
654
end
638
655
639
656
desc'shard_promote_master_writes','Lockless shard master promotion (step 3 of 4): move writes to new master'
657
+
method_option:shard_pool,:desc=>'The sharding pool for which to perform the promotion'
640
658
defshard_promote_master_writes
641
-
s=ask_shard_being_promoted:writes
659
+
shard_pool=options[:shard_pool] || ask("Please enter the sharding pool for which to perform the master promotion (enter for default pool, #{Jetpants.topology.default_shard_pool}): ")
raise"Shard #{s} is in wrong state to perform this action! Expected :child, found #{s.state}"
644
664
end
@@ -659,8 +679,11 @@ module Jetpants
659
679
end
660
680
661
681
desc'shard_promote_master_cleanup','Lockless shard master promotion (step 4 of 4): clean up shard and eject old master'
682
+
method_option:shard_pool,:desc=>'The sharding pool for which to perform the promotion'
662
683
defshard_promote_master_cleanup
663
-
s=ask_shard_being_promoted:cleanup
684
+
shard_pool=options[:shard_pool] || ask("Please enter the sharding pool for which to perform the master promotion (enter for default pool, #{Jetpants.topology.default_shard_pool}): ")
# Since Jetpants is extremely multi-threaded, we need to force uncaught exceptions to
15
15
# kill all threads in order to have any kind of sane error handling.
@@ -37,7 +37,7 @@ module Jetpants
37
37
'verify_replication'=>true,# raise exception if the 2 repl threads are in different states, or if actual repl topology differs from Jetpants' understanding of it
38
38
'plugins'=>{},# hash of plugin name => arbitrary plugin data (usually a nested hash of settings)
39
39
'ssh_keys'=>nil,# array of SSH key file locations
40
-
'sharded_tables'=>[],# array of name => {sharding_key=>X, chunks=>Y} hashes
40
+
'sharded_tables'=>[],# hash of {shard_pool => {name => {sharding_key=>X, chunks=>Y}} hashes
41
41
'compress_with'=>false,# command line to use for compression in large file transfers
42
42
'decompress_with'=>false,# command line to use for decompression in large file transfers
43
43
'private_interface'=>'bond0',# network interface corresponding to private IP
@@ -48,6 +48,14 @@ module Jetpants
48
48
'log_file'=>'/var/log/jetpants.log',# where to log all output from the jetpants commands
49
49
'local_private_interface'=>nil,# local network interface corresponding to private IP of the machine jetpants is running on
50
50
'free_mem_min_mb'=>0,# Minimum amount of free memory in MB to be maintained on the node while performing the task (eg. network copy)
51
+
'default_shard_pool'=>nil,# default pool for sharding operations
0 commit comments