Skip to content

Commit

Permalink
Resolving bug where the placement info that gets allocated to a maste…
Browse files Browse the repository at this point in the history
…r/tserver is off by one respect to the command line argument.

Summary:
The placement info that gets allocated to a master/tserver is off by one with respect to
the command line arguments passed. This was because of the fact that master/tserver index starts
from 1 and not 0.

Test Plan:
Tested that the placement info is passed down in the correct order as expected.

Command:

`bin/yb-ctl --rf 4 create --placement_info "cloud1.region1.zone1,cloud2.region2.zone2"`

Output:

```2018-03-08 16:45:14,333 INFO: Starting master-1 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-master --fs_data_dirs "/tmp/yugabyte-local-cluster/node-1/disk-1,/tmp/yugabyte-local-cluster/node-1/disk-2" --webserver_interface 127.0.0.1 --rpc_bind_addresses 127.0.0.1 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --replication_factor=4 --master_addresses 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --placement_cloud cloud1 --placement_region region1 --placement_zone zone1 >"/tmp/yugabyte-local-cluster/node-1/disk-1/master.out" 2>"/tmp/yugabyte-local-cluster/node-1/disk-1/master.err" &
2018-03-08 16:45:14,362 INFO: Starting master-2 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-master --fs_data_dirs "/tmp/yugabyte-local-cluster/node-2/disk-1,/tmp/yugabyte-local-cluster/node-2/disk-2" --webserver_interface 127.0.0.2 --rpc_bind_addresses 127.0.0.2 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --replication_factor=4 --master_addresses 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --placement_cloud cloud2 --placement_region region2 --placement_zone zone2 >"/tmp/yugabyte-local-cluster/node-2/disk-1/master.out" 2>"/tmp/yugabyte-local-cluster/node-2/disk-1/master.err" &
2018-03-08 16:45:14,388 INFO: Starting master-3 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-master --fs_data_dirs "/tmp/yugabyte-local-cluster/node-3/disk-1,/tmp/yugabyte-local-cluster/node-3/disk-2" --webserver_interface 127.0.0.3 --rpc_bind_addresses 127.0.0.3 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --replication_factor=4 --master_addresses 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --placement_cloud cloud1 --placement_region region1 --placement_zone zone1 >"/tmp/yugabyte-local-cluster/node-3/disk-1/master.out" 2>"/tmp/yugabyte-local-cluster/node-3/disk-1/master.err" &
2018-03-08 16:45:14,414 INFO: Starting master-4 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-master --fs_data_dirs "/tmp/yugabyte-local-cluster/node-4/disk-1,/tmp/yugabyte-local-cluster/node-4/disk-2" --webserver_interface 127.0.0.4 --rpc_bind_addresses 127.0.0.4 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --replication_factor=4 --master_addresses 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --placement_cloud cloud2 --placement_region region2 --placement_zone zone2 >"/tmp/yugabyte-local-cluster/node-4/disk-1/master.out" 2>"/tmp/yugabyte-local-cluster/node-4/disk-1/master.err" &
2018-03-08 16:45:14,461 INFO: Starting tserver-1 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-tserver --fs_data_dirs "/tmp/yugabyte-local-cluster/node-1/disk-1,/tmp/yugabyte-local-cluster/node-1/disk-2" --webserver_interface 127.0.0.1 --rpc_bind_addresses 127.0.0.1 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --tserver_master_addrs 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --memory_limit_hard_bytes 1073741824 --yb_num_shards_per_tserver 2 --redis_proxy_bind_address 127.0.0.1 --cql_proxy_bind_address 127.0.0.1 --local_ip_for_outbound_sockets 127.0.0.1 --use_cassandra_authentication=false --placement_cloud cloud1 --placement_region region1 --placement_zone zone1 >"/tmp/yugabyte-local-cluster/node-1/disk-1/tserver.out" 2>"/tmp/yugabyte-local-cluster/node-1/disk-1/tserver.err" &
2018-03-08 16:45:14,570 INFO: Starting tserver-2 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-tserver --fs_data_dirs "/tmp/yugabyte-local-cluster/node-2/disk-1,/tmp/yugabyte-local-cluster/node-2/disk-2" --webserver_interface 127.0.0.2 --rpc_bind_addresses 127.0.0.2 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --tserver_master_addrs 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --memory_limit_hard_bytes 1073741824 --yb_num_shards_per_tserver 2 --redis_proxy_bind_address 127.0.0.2 --cql_proxy_bind_address 127.0.0.2 --local_ip_for_outbound_sockets 127.0.0.2 --use_cassandra_authentication=false --placement_cloud cloud2 --placement_region region2 --placement_zone zone2 >"/tmp/yugabyte-local-cluster/node-2/disk-1/tserver.out" 2>"/tmp/yugabyte-local-cluster/node-2/disk-1/tserver.err" &
2018-03-08 16:45:14,702 INFO: Starting tserver-3 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-tserver --fs_data_dirs "/tmp/yugabyte-local-cluster/node-3/disk-1,/tmp/yugabyte-local-cluster/node-3/disk-2" --webserver_interface 127.0.0.3 --rpc_bind_addresses 127.0.0.3 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --tserver_master_addrs 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --memory_limit_hard_bytes 1073741824 --yb_num_shards_per_tserver 2 --redis_proxy_bind_address 127.0.0.3 --cql_proxy_bind_address 127.0.0.3 --local_ip_for_outbound_sockets 127.0.0.3 --use_cassandra_authentication=false --placement_cloud cloud1 --placement_region region1 --placement_zone zone1 >"/tmp/yugabyte-local-cluster/node-3/disk-1/tserver.out" 2>"/tmp/yugabyte-local-cluster/node-3/disk-1/tserver.err" &
2018-03-08 16:45:14,854 INFO: Starting tserver-4 with:
/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise/bin/yb-tserver --fs_data_dirs "/tmp/yugabyte-local-cluster/node-4/disk-1,/tmp/yugabyte-local-cluster/node-4/disk-2" --webserver_interface 127.0.0.4 --rpc_bind_addresses 127.0.0.4 --v 0 --version_file_json_path=/Users/ayushsengupta/code/yugabyte/build/debug-clang-dynamic-enterprise --callhome_enabled=false --tserver_master_addrs 127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100,127.0.0.4:7100 --memory_limit_hard_bytes 1073741824 --yb_num_shards_per_tserver 2 --redis_proxy_bind_address 127.0.0.4 --cql_proxy_bind_address 127.0.0.4 --local_ip_for_outbound_sockets 127.0.0.4 --use_cassandra_authentication=false --placement_cloud cloud2 --placement_region region2 --placement_zone zone2 >"/tmp/yugabyte-local-cluster/node-4/disk-1/tserver.out" 2>"/tmp/yugabyte-local-cluster/node-4/disk-1/tserver.err" &```

Reviewers: bogdan

Reviewed By: bogdan

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D4314
  • Loading branch information
ayushsengupta1991 committed Mar 14, 2018
1 parent 280fdc0 commit 2726eac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/yb-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class ClusterControl:
custom_flags = self.get_tserver_only_flags(daemon_id)

if len(self.options.placement_info) > 0:
mod_val = daemon_id.index % len(self.options.placement_info)
mod_val = (daemon_id.index - 1) % len(self.options.placement_info)
custom_flags.extend(self.get_placement_info_flags(self.options.placement_info[mod_val]))
command = self.build_command(daemon_id, custom_flags)
logging.info("Starting {} with:\n{}".format(daemon_id, command))
Expand Down

0 comments on commit 2726eac

Please sign in to comment.