Skip to content

Commit

Permalink
[BACKPORT 2024.1][#23273] yugabyted: Fix `yugabyted configure_read_re…
Browse files Browse the repository at this point in the history
…plica` commands.

Summary:
Original commit: 50931bf / D36842
* 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: sgarg-yb, yugabyted-dev

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D37057
  • Loading branch information
gargsans-yb committed Aug 12, 2024
1 parent e51254e commit f39a698
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 @@ -6783,6 +6783,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 @@ -6794,8 +6796,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 @@ -6819,6 +6821,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 @@ -6830,9 +6834,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 f39a698

Please sign in to comment.