Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for handling SCYLLA_EXT_OPTS correctly #541

Closed
wants to merge 2 commits into from

Conversation

eliransin
Copy link

@eliransin eliransin commented Dec 10, 2023

This mini-series implements two fixes for handling SCYLLA_EXT_OPTS:

  1. It adds support for -c and -m options which are abbreviations for the --smp and --memory options and handles them correctly.
  2. It adds support for multiple occurrences of --experimental-features with correct handling.

The individual issues:
#539 and #540 describes the specific problems.

Eliran Sinvani added 2 commits December 10, 2023 10:58
when starting a cluster with an `SCYLLA_EXT_OPTS` env variable, if the
user sets the smp or memory using the abbreviated option name (-c or
-m), ScyllaDB will fail on startup due to double use of parameters.
This is because scylla-ccm fails to account for --smp and -c (for
example) as the same option, injecting the literal option into the
command line parameters.
Here we change this for --smp and --memory, with the option to add more
similar cases in the future.

Fixes scylladb#539

Signed-off-by: Eliran Sinvani <[email protected]>
Some scylla command lines options may and might appear more than
once with different values, a concrete example for this, which this
commit handles is `--experimental-features` when more than one
experimental feature needs to be enabled.

Fixes scylladb#540
Signed-off-by: Eliran Sinvani <[email protected]>
@tchaikov tchaikov removed their assignment Dec 14, 2023
@tchaikov
Copy link
Contributor

I will review this change once I am back from my PTO.

@eliransin
Copy link
Author

@tchaikov ping

@@ -570,11 +570,12 @@ def process_opts(opts):
opts_i += 1
val = ' '.join(vals)
if key not in ext_args and not key.startswith("--scylla-manager"):
ext_args[key] = val
ext_args[args_translation_map.get(key, key)] = val
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd suggest normalize key even before the if key not in ext_args and not key.startswith("--scylla-manager") check, and do this unconditially. like:

key = args_translation_map.get(key, key)
if key not in ext_args and not key.startswith("--scylla-manager"):
    ext_args[key] = val

for better readaiblity.

ext_args = OrderedDict()
def should_add_option(key):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the nested function is more readable, but it also renders this method more complicated, how about this?

if key.startswith("--scylla-manager"):
    continue

if key in allowed_duplicates_set:
    ext_args.get(key, []).append(val)
elif key not in ext_args:
    ext_args[key] = val

for following reasons:

  1. the combinations of conditions is getting convoluted in this function, better off simplifying them
  2. dict.set_default() helps to consolidate the logic, but it hurts the readability.
  3. we should not use list for all values of options. the boxing-unboxing hurts the readability.

@tchaikov
Copy link
Contributor

@eliransin hi Eliran, sorry for the latency. left a couple comments.

fruch added a commit to fruch/scylla-ccm that referenced this pull request Feb 5, 2024
since we have cases multiple `--experimental-features` needs
to be passed via `SCYLLA_EXT_OPTS`, adding support for key
with multiple values in `process_opts()`

fixes: scylladb#540
closes: scylladb#541
fruch added a commit to fruch/scylla-ccm that referenced this pull request Feb 6, 2024
since we have cases multiple `--experimental-features` needs
to be passed via `SCYLLA_EXT_OPTS`, adding support for key
with multiple values in `process_opts()`

fixes: scylladb#540
closes: scylladb#541
fruch added a commit to fruch/scylla-ccm that referenced this pull request Feb 6, 2024
since we have cases multiple `--experimental-features` needs
to be passed via `SCYLLA_EXT_OPTS`, adding support for key
with multiple values in `process_opts()`

fixes: scylladb#540
closes: scylladb#541
@fruch
Copy link
Contributor

fruch commented Mar 7, 2024

closing in favor of #558

@fruch fruch closed this Mar 7, 2024
fruch added a commit to fruch/scylla-ccm that referenced this pull request Mar 10, 2024
since we have cases multiple `--experimental-features` needs
to be passed via `SCYLLA_EXT_OPTS`, adding support for key
with multiple values in `process_opts()`

fixes: scylladb#540
closes: scylladb#541
fruch added a commit that referenced this pull request Mar 11, 2024
since we have cases multiple `--experimental-features` needs
to be passed via `SCYLLA_EXT_OPTS`, adding support for key
with multiple values in `process_opts()`

fixes: #540
closes: #541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants