(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:script_root) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: <Left_Backtick "`"> spids: [70 78] ) } spids: [69] ) ] spids: [69] ) (C {(source)} {($ VSub_Name "$script_root") (/env.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cells) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$CELLS")}) (C {(tr)} {(SQ <",">)} {(SQ <" ">)}) ] negated: False ) ] ) left_token: <Left_Backtick "`"> spids: [87 103] ) } spids: [86] ) ] spids: [86] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:num_cells) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [(C {(echo)} {($ VSub_Name "$cells")}) (C {(wc)} {(-w)})] negated: False ) ] ) left_token: <Left_Backtick "`"> spids: [106 116] ) } spids: [105] ) ] spids: [105] ) (FuncDef name: update_spinner_value body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:spinner) op: Equal rhs: {(SQ <"-\\|/">)} spids: [129] ) ] spids: [129] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cur_spinner) op: Equal rhs: { (BracedVarSub token: <VSub_Name spinner> suffix_op: (Slice begin: (ArithWord w: { (ArithSubPart anode: (ArithBinary op_id: Arith_Percent left: (ArithWord w:{($ VSub_Number "$1")}) right: (ArithWord w: { (BracedVarSub token: <VSub_Name spinner> prefix_op: VSub_Pound spids: [142 145] ) } ) ) spids: [139 147] ) } ) length: (ArithWord w:{(Lit_Digits 1)}) ) spids: [136 150] ) } spids: [135] ) ] spids: [135] ) ] spids: [126] ) spids: [119 125] ) (FuncDef name: wait_for_running_tasks body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:task_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [185] ) ] spids: [185] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:num_tasks) op: Equal rhs: {($ VSub_Number "$2")} spids: [189] ) ] spids: [189] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:counter) op:Equal rhs:{(0)} spids:[193])] spids: [193] ) (C {(echo)} { (DQ ("Waiting for ") (${ VSub_Name num_tasks) ("x ") ($ VSub_Name "$task_name") (" to enter state Running") ) } ) (While cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$counter")} {(-lt)} {($ VSub_Name "$MAX_TASK_WAIT_RETRIES")} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:num_running) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {($ VSub_Name "$KUBECTL")} {(get)} {(pods)}) (C {(grep)} {(Lit_Other "^") ($ VSub_Name "$task_name")}) (C {(grep)} {(Running)}) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: <Left_Backtick "`"> spids: [237 262] ) } spids: [236] ) ] spids: [236] ) (C {(echo)} {(-en)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\r">) ($ VSub_Name "$task_name") (": ") ($ VSub_Name "$num_running") (" out of ") ($ VSub_Name "$num_tasks") (" in state Running...") ) } ) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {($ VSub_Name "$num_running")} {(-eq)} {($ VSub_Name "$num_tasks")} {(Lit_Other "]")} ) ] action: [ (C {(echo)} {(Complete)}) (ControlFlow token: <ControlFlow_Return return> arg_word: {(0)} ) ] spids: [-1 294] ) ] spids: [-1 307] ) (C {(update_spinner_value)} {($ VSub_Name "$counter")}) (C {(echo)} {(-n)} {($ VSub_Name "$cur_spinner")}) (C {(let)} {(Lit_VarLike "counter=") (counter) (Lit_Other "+") (1)}) (C {(sleep)} {(1)}) ] spids: [225 335] ) ) (C {(echo)} {(Timed)} {(out)}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(-1)}) ] spids: [162] ) spids: [155 161] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$GOPATH"))} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("ERROR: GOPATH undefined, can't obtain vtctlclient"))}) (C {(exit)} {(-1)}) ] spids: [-1 365] ) ] spids: [-1 379] ) (C {(export)} {(Lit_VarLike "KUBECTL=") (SQ <kubectl>)}) (C {(echo)} {(DQ ("Downloading and installing vtctlclient..."))}) (C {(go)} {(get)} {(-u)} {(github.com/youtube/vitess/go/cmd/vtctlclient)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:num_shards) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$SHARDS")}) (C {(tr)} {(DQ (","))} {(DQ (" "))}) (C {(wc)} {(-w)}) ] negated: False ) ] ) left_token: <Left_Backtick "`"> spids: [405 427] ) } spids: [404] ) ] spids: [404] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:total_tablet_count) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Star left: (ArithBinary op_id: Arith_Star left: (ArithWord w:{($ VSub_Name "$num_shards")}) right: (ArithWord w:{($ VSub_Name "$TABLETS_PER_SHARD")}) ) right: (ArithWord w:{($ VSub_Name "$num_cells")}) ) spids: [430 437] ) } spids: [429] ) ] spids: [429] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:vtgate_count) op: Equal rhs: {($ VSub_Name "$VTGATE_COUNT")} spids: [439] ) ] spids: [439] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$vtgate_count")} {(-eq)} {(0)} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:vtgate_count) op: Equal rhs: { (ArithSubPart anode: (TernaryOp cond: (ArithBinary op_id: Arith_Great left: (ArithBinary op_id: Arith_Slash left: (ArithWord w:{($ VSub_Name "$total_tablet_count")}) right: (ArithWord w:{(Lit_Digits 4)}) ) right: (ArithWord w:{(Lit_Digits 3)}) ) true_expr: (ArithBinary op_id: Arith_Slash left: (ArithWord w:{($ VSub_Name "$total_tablet_count")}) right: (ArithWord w:{(Lit_Digits 4)}) ) false_expr: (ArithWord w:{(Lit_Digits 3)}) ) spids: [459 472] ) } spids: [458] ) ] spids: [458] ) ] spids: [-1 455] ) ] spids: [-1 474] ) (C {(echo)} {(DQ ("****************************"))}) (C {(echo)} {(DQ ("*Creating vitess cluster:"))}) (C {(echo)} {(DQ ("* Shards: ") ($ VSub_Name "$SHARDS"))}) (C {(echo)} {(DQ ("* Tablets per shard: ") ($ VSub_Name "$TABLETS_PER_SHARD"))}) (C {(echo)} {(DQ ("* Rdonly per shard: ") ($ VSub_Name "$RDONLY_COUNT"))}) (C {(echo)} {(DQ ("* VTGate count: ") ($ VSub_Name "$vtgate_count"))}) (C {(echo)} {(DQ ("* Cells: ") ($ VSub_Name "$cells"))}) (C {(echo)} {(DQ ("****************************"))}) (AndOr children: [ (C {(echo)} {(SQ <"Running etcd-up.sh">)}) (SimpleCommand words: [{(./etcd-up.sh)}] more_env: [(env_pair name:CELLS val:{($ VSub_Name "$CELLS")} spids:[539])] ) ] op_id: Op_DAmp ) (C {(wait_for_running_tasks)} {(etcd-global)} {(3)}) (ForEach iter_name: cell iter_words: [{($ VSub_Name "$cells")}] do_arg_iter: False body: (DoGroup children: [(C {(wait_for_running_tasks)} {(etcd-) ($ VSub_Name "$cell")} {(3)})] spids: [559 569] ) spids: [555 557] ) (AndOr children: [(C {(echo)} {(SQ <"Running vtctld-up.sh">)}) (C {(./vtctld-up.sh)})] op_id: Op_DAmp ) (AndOr children: [ (C {(echo)} {(SQ <"Running vttablet-up.sh">)}) (SimpleCommand words: [{(./vttablet-up.sh)}] more_env: [(env_pair name:CELLS val:{($ VSub_Name "$CELLS")} spids:[590])] ) ] op_id: Op_DAmp ) (AndOr children: [(C {(echo)} {(SQ <"Running vtgate-up.sh">)}) (C {(./vtgate-up.sh)})] op_id: Op_DAmp ) (C {(wait_for_running_tasks)} {(vtctld)} {(1)}) (C {(wait_for_running_tasks)} {(vttablet)} {($ VSub_Name "$total_tablet_count")}) (C {(wait_for_running_tasks)} {(vtgate)} {($ VSub_Name "$vtgate_count")}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:vtctld_port) op:Equal rhs:{(30001)} spids:[625])] spids: [625] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:vtctld_ip) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(kubectl)} {(get)} {(-o)} {(yaml)} {(nodes)}) (C {(grep)} {(SQ <"type: ExternalIP">)} {(-B)} {(1)}) (C {(head)} {(-1)}) (C {(awk)} {(SQ <"{print $NF}">)}) ] negated: False ) ] ) left_token: <Left_Backtick "`"> spids: [629 665] ) } spids: [628] ) ] spids: [628] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:vtctl_server) op: Equal rhs: {(DQ ($ VSub_Name "$vtctld_ip") (":") ($ VSub_Name "$vtctld_port"))} spids: [667] ) ] spids: [667] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kvtctl) op: Equal rhs: { (DQ ($ VSub_Name "$GOPATH") ("/bin/vtctlclient -server ") ($ VSub_Name "$vtctl_server")) } spids: [674] ) ] spids: [674] ) (C {(echo)} {(Waiting)} {(KW_For for)} {(tablets)} {(to)} {(be)} {(visible)} {(KW_In in)} {(the)} {(topology)} ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:counter) op:Equal rhs:{(0)} spids:[702])] spids: [702] ) (While cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$counter")} {(-lt)} {($ VSub_Name "$MAX_VTTABLET_TOPO_WAIT_RETRIES")} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:num_tablets) op:Equal rhs:{(0)} spids:[721])] spids: [721] ) (ForEach iter_name: cell iter_words: [{($ VSub_Name "$cells")}] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:num_tablets) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$num_tablets")}) right: (ArithWord w: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {($ VSub_Name "$kvtctl")} {(ListAllTablets)} {($ VSub_Name "$cell")} ) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: <Left_Backtick "`"> spids: [741 753] ) } ) ) spids: [738 755] ) } spids: [737] ) ] spids: [737] ) ] spids: [734 758] ) spids: [730 732] ) (C {(echo)} {(-en)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\r">) ($ VSub_Name "$num_tablets") (" out of ") ($ VSub_Name "$total_tablet_count") (" in topology...") ) } ) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {($ VSub_Name "$num_tablets")} {(-eq)} {($ VSub_Name "$total_tablet_count")} {(Lit_Other "]")} ) ] action: [(C {(echo)} {(Complete)}) (ControlFlow token:<ControlFlow_Break break>)] spids: [-1 787] ) ] spids: [-1 798] ) (C {(update_spinner_value)} {($ VSub_Name "$counter")}) (C {(echo)} {(-n)} {($ VSub_Name "$cur_spinner")}) (C {(let)} {(Lit_VarLike "counter=") (counter) (Lit_Other "+") (1)}) (C {(sleep)} {(1)}) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {($ VSub_Name "$counter")} {(-eq)} {($ VSub_Name "$MAX_VTTABLET_TOPO_WAIT_RETRIES")} {(Lit_Other "]")} ) ] action: [(C {(echo)} {(Timed)} {(out)})] spids: [-1 839] ) ] spids: [-1 849] ) ] spids: [718 851] ) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:split_shard_count) op: Equal rhs: {($ VSub_Name "$num_shards")} spids: [857] ) ] spids: [857] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$split_shard_count")} {(-eq)} {(1)} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:split_shard_count) op: Equal rhs: {(0)} spids: [876] ) ] spids: [876] ) ] spids: [-1 873] ) ] spids: [-1 879] ) (C {(echo)} {(-n)} {(Setting)} {(Keyspace)} {(Sharding)} {(Info...)}) (C {($ VSub_Name "$kvtctl")} {(SetKeyspaceShardingInfo)} {(-force)} {(-split_shard_count)} {($ VSub_Name "$split_shard_count")} {(test_keyspace)} {(keyspace_id)} {(uint64)} ) (C {(echo)} {(Done)}) (C {(echo)} {(-n)} {(Rebuilding)} {(Keyspace)} {(Graph...)}) (C {($ VSub_Name "$kvtctl")} {(RebuildKeyspaceGraph)} {(test_keyspace)}) (C {(echo)} {(Done)}) (C {(echo)} {(-n)} {(Reparenting...)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:shard_num) op:Equal rhs:{(1)} spids:[940])] spids: [940] ) (ForEach iter_name: shard iter_words: [ { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$SHARDS")}) (C {(tr)} {(DQ (","))} {(DQ (" "))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [949 965] ) } ] do_arg_iter: False body: (DoGroup children: [ (C {($ VSub_Name "$kvtctl")} {(InitShardMaster)} {(-force)} {(test_keyspace/) ($ VSub_Name "$shard")} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$cells")}) (C {(awk)} {(SQ <"{print $1}">)}) ] negated: False ) ] ) left_token: <Left_Backtick "`"> spids: [980 992] ) (-0000000) (${ VSub_Name shard_num) (00) } ) (C {(let)} {(Lit_VarLike "shard_num=") (shard_num) (Lit_Other "+") (1)}) ] spids: [968 1007] ) spids: [948 966] ) (C {(echo)} {(Done)}) (C {(echo)} {(-n)} {(Applying)} {(Schema...)}) (C {($ VSub_Name "$kvtctl")} {(ApplySchema)} {(-sql)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(cat)} {(create_test_table.sql)})]) left_token: <Left_CommandSub "$("> spids: [1028 1032] ) ) } {(test_keyspace)} ) (C {(echo)} {(Done)}) (C {(echo)} {(DQ ("****************************"))}) (C {(echo)} {(DQ ("* Complete!"))}) (C {(echo)} {(DQ ("* Use the following line to make an alias to kvtctl:"))}) (C {(echo)} { (DQ ("* alias kvtctl='") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) ("GOPATH/bin/vtctlclient -server ") ($ VSub_Name "$vtctl_server") ("'") ) } ) (C {(echo)} {(DQ ("* See the vtctld UI at: http://") (${ VSub_Name vtctld_ip) (":30000"))}) (C {(echo)} {(DQ ("****************************"))}) ] )