Skip to content

Commit

Permalink
[#21364] yugabyted: Support for allowed_preview_flags_csv master gfla…
Browse files Browse the repository at this point in the history
…g as a multiple value flag.

Summary:
Add support for `allowed_preview_flags_csv` advanced flag in the set of master flags.
Jira: DB-10262

Test Plan: Manual Testing

Reviewers: sgarg-yb

Reviewed By: sgarg-yb

Subscribers: yugabyted-dev, shikhar.sahay

Differential Revision: https://phorge.dev.yugabyte.com/D32987
  • Loading branch information
ShikharSahay committed Mar 8, 2024
1 parent 1acec92 commit f273ffe
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions bin/yugabyted
Original file line number Diff line number Diff line change
Expand Up @@ -2747,16 +2747,55 @@ class ControlScript(object):
"--default_memory_limit_to_ram_ratio=0.35",
"--instance_uuid_override={}".format(self.configs.saved_data.get("master_uuid")),
]

master_flags = self.configs.saved_data.get("master_flags","")

# if a join ip is specified, bring up a shell mode master
if not join_ip:
yb_master_cmd.append("--master_addresses={}".format(master_addresses))
yb_master_cmd.append("--cluster_uuid={}".format(
self.configs.saved_data.get("universe_uuid")))

if self.configs.saved_data.get("master_flags"):
# If allowed_preview_flags_csv is present
# Extract the value of allowed_preview_flags_csv
# Remove the flag present in the master_flags string
if master_flags.find("allowed_preview_flags_csv") != -1:
allowed_preview_flags_csv_start_index = master_flags.find('allowed_preview_flags_csv')
allowed_preview_flags_csv_end_index = master_flags.find('}',
allowed_preview_flags_csv_start_index) + 1
allowed_preview_flags_csv_flag = master_flags[allowed_preview_flags_csv_start_index:\
allowed_preview_flags_csv_end_index]
allowed_preview_flags_csv_flag = allowed_preview_flags_csv_flag[
allowed_preview_flags_csv_flag.find("{")+1:-1]

# Check and handle if the allowed_preview_flags_csv_flag is
# empty after removing the curly braces
if allowed_preview_flags_csv_flag:
# If the value was given through the config file
# remove the starting and ending quotes.
if allowed_preview_flags_csv_flag[0] == "'" and \
allowed_preview_flags_csv_flag[-1] == "'":
allowed_preview_flags_csv_flag = allowed_preview_flags_csv_flag[1:-1]
elif allowed_preview_flags_csv_flag[0] == '"' and \
allowed_preview_flags_csv_flag[-1] == '"':
allowed_preview_flags_csv_flag = allowed_preview_flags_csv_flag[1:-1]

yb_master_cmd.extend(["--allowed_preview_flags_csv={}".format(
allowed_preview_flags_csv_flag)])
else:
# If the flag is empty, reset the configuration by not adding it
pass
# Remove the flag present in master_flags
if allowed_preview_flags_csv_start_index == 0:
master_flags = master_flags[allowed_preview_flags_csv_end_index+1:]
else:
master_flags = master_flags[:allowed_preview_flags_csv_start_index-1] + \
master_flags[allowed_preview_flags_csv_end_index:]

if master_flags:
yb_master_cmd.extend(
["--{}".format(flag) for flag in \
self.configs.saved_data.get("master_flags").split(",")])
master_flags.split(",")])

return yb_master_cmd

Expand Down

0 comments on commit f273ffe

Please sign in to comment.