Skip to content

Commit

Permalink
[#23273] yugabyted: Fix yugabyted configure_read_replica commands.
Browse files Browse the repository at this point in the history
Summary:
* Added checks to `yugabyted configure_read_replica` commands to check if `:<num_of_replicas> is provided in the `--data_placement_constraint` flag.
Jira: DB-12201

Test Plan: ./yb_build.sh --java-test 'org.yb.yugabyted.*'

Reviewers: nikhil

Reviewed By: nikhil

Subscribers: yugabyted-dev, sgarg-yb

Differential Revision: https://phorge.dev.yugabyte.com/D36842
  • Loading branch information
gargsans-yb committed Aug 5, 2024
1 parent 0361ed7 commit 50931bf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/yugabyted
Original file line number Diff line number Diff line change
Expand Up @@ -6864,6 +6864,8 @@ class ControlScript(object):
data_constraints = args.data_placement_constraint.split(",")
has_errors = False
for constraint in data_constraints:
if ':' not in constraint:
has_errors = True
cloud_info = constraint.split(":")[0].split(".")
if (len(cloud_info) == 3):
for value in cloud_info:
Expand All @@ -6875,8 +6877,8 @@ class ControlScript(object):
if has_errors:
Output.print_out(Output.make_red("ERROR") +
": Incorrect value specified for --data_placement_constraint. " +
"Please specify comma sperated value with format " +
"- cloudprovider.region.zone")
"Please specify comma sperated values with the num of replicas with " +
"format - <cloudprovider.region.zone>:<num_of_replicas>")
else:
self.configs.temp_data[
"rr_data_placement_constraint"] = args.data_placement_constraint
Expand All @@ -6900,6 +6902,8 @@ class ControlScript(object):
data_constraints = args.data_placement_constraint.split(",")
has_errors = False
for constraint in data_constraints:
if ':' not in constraint:
has_errors = True
cloud_info = constraint.split(".")
if (len(cloud_info) == 3):
for value in cloud_info:
Expand All @@ -6911,9 +6915,8 @@ class ControlScript(object):
if has_errors:
Output.print_out(
"Incorrect value specified for --data_placement_constraint. " +
"Please specify comma sperated value with format " +
"- cloudprovider.region.zone".format(
args.data_placement_constraint))
"Please specify comma sperated values with the num of replicas with " +
"format - <cloudprovider.region.zone>:<num_of_replicas>")
else:
self.configs.temp_data[
"rr_data_placement_constraint"] = args.data_placement_constraint
Expand Down

0 comments on commit 50931bf

Please sign in to comment.