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

allow property aliases in redpanda.yaml, fix aliases not being applied #15605

Merged
merged 6 commits into from
Dec 19, 2023

Conversation

andijcr
Copy link
Contributor

@andijcr andijcr commented Dec 14, 2023

Property aliases are not included in the ignored items when reading a node yaml config or cluster yaml config.

This pr fixes 3 distinct but related bugs:

  1. aliases not being being applied
  • solved with the first commit. when searching for a property with an alias, do not skip applying the value
  1. aliases in bootstrapping redpanda.yaml causing std::illegal_argument exceptions
  • with commit 4-5 include aliases in the list of names to be ignored when setting node config

3. properties set with aliases reverting to a previous value after a restart, under some conditions.
- with commit 6 translate aliases to the main name before applying it to the controller log. this is more a workaround than a proper fix of the underlying issue, as described in #13362

edit: #15725 should be a proper fix for #13362. so the third commit is no longer necessary. once that merge, this can merge on top

Fixes #15603

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x
  • v23.1.x
  • v22.3.x

Release Notes

Bug Fixes

  • cluster config aliases are accepted while reading from yaml

Comment on lines 73 to 93
auto found = _properties.find(name);
if (found == _properties.end()) {
found = _aliases.find(name);
if (found == _aliases.end()) {
if (!ignore_missing.contains(name)) {
throw std::invalid_argument(
fmt::format("Unknown property {}", name));
}
auto* prop = [&]() -> base_property* {
auto primary = _properties.find(name);
if (primary != _properties.end()) {
return primary->second;
}
} else {
bool ok = false;
try {
auto validation_err = found->second->validate(node.second);
if (validation_err.has_value()) {
errors[name] = fmt::format(
"Validation error: {}",
validation_err.value().error_message());
}

found->second->set_value(node.second);
ok = true;
Copy link
Member

Choose a reason for hiding this comment

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

config_store bug about not considering aliases for bootstrap

please describe the problem that is fixed in this commit, and how it is fixed. it also looks like there is some code moved / refactored? if so, that could be a separate commit to make it easier to understand the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, splitted it apart. the first commit has the first fix, the following are some cosmetic change to bring it up smoothly at this stage

Copy link
Member

@dotnwat dotnwat left a comment

Choose a reason for hiding this comment

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

what test(s) should we add?

@andijcr andijcr force-pushed the issue/15603/config_tests branch from fb0bce5 to c6f5348 Compare December 15, 2023 17:48
@andijcr andijcr changed the title Issue/15603/config tests allow property aliases in redpanda.yaml Dec 15, 2023
@andijcr andijcr requested review from dotnwat and andrwng December 15, 2023 18:21
@andijcr
Copy link
Contributor Author

andijcr commented Dec 15, 2023

what test(s) should we add?

e132fa0

and another where we trigger the invalid argument check.

in cluster_config_test.py

@dotnwat
Copy link
Member

dotnwat commented Dec 15, 2023

what test(s) should we add?
e132fa0
and another where we trigger the invalid argument check.

As far as I can tell the issue linked to in this PR doesn't mention any failing tests. So maybe it's changing / fixing some behavior? If so, that would qualify for a test or update to a test?

Copy link
Contributor

@andrwng andrwng left a comment

Choose a reason for hiding this comment

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

The changes look good, but will wait on a test to approve. It'd be great to at least cover the behavior in the issue, where delete_retention_ms is set in the config

src/v/config/config_store.h Outdated Show resolved Hide resolved
andijcr and others added 5 commits December 15, 2023 21:07
before this commit, finding the name in the alias table would not throw
the std::invalid_argument exception. but would not set the property.
non functional change, the optional was just used inside a code block
property_aliases() mirrors property_names()
and both get merged in property_names_and_aliases(), to be used instead
of property_names when filtering/scanning over user input
this allows to include prop aliases when validating external input
@andijcr andijcr force-pushed the issue/15603/config_tests branch from c6f5348 to 1f12a5c Compare December 15, 2023 23:07
@andijcr
Copy link
Contributor Author

andijcr commented Dec 15, 2023

the last commit address issue #15263 and #13362
by converting aliases to the primary name before writing them to the log.

it's a partial solution, because if the cluster is in the middle of an upgrade, the conversion is skipped (and this in not strictly required. we could save the version when an alias is introduced, to skip conversion only for the latest)

@andijcr andijcr requested a review from andrwng December 15, 2023 23:11
Copy link
Contributor

@andrwng andrwng left a comment

Choose a reason for hiding this comment

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

The first few commits lgtm, but I've got some questions about the last one.

Still would be great to have a test for the functional changes

src/v/cluster/config_frontend.cc Outdated Show resolved Hide resolved
src/v/cluster/config_frontend.cc Outdated Show resolved Hide resolved
src/v/cluster/config_frontend.cc Outdated Show resolved Hide resolved
src/v/cluster/config_frontend.cc Outdated Show resolved Hide resolved
src/v/cluster/config_frontend.cc Outdated Show resolved Hide resolved
@piyushredpanda piyushredpanda added this to the v23.3.1-rc5 milestone Dec 16, 2023
@andijcr andijcr changed the title allow property aliases in redpanda.yaml allow property aliases in redpanda.yaml, fix aliases not being applied and convert aliases to proper names in the controller.log Dec 18, 2023
@andijcr andijcr force-pushed the issue/15603/config_tests branch from 1f12a5c to b025e34 Compare December 18, 2023 17:08
@andijcr andijcr requested a review from andrwng December 18, 2023 17:08
@andijcr
Copy link
Contributor Author

andijcr commented Dec 18, 2023

force push: removed last commit, the issue was solved with #15725

@andijcr andijcr changed the title allow property aliases in redpanda.yaml, fix aliases not being applied and convert aliases to proper names in the controller.log allow property aliases in redpanda.yaml, fix aliases not being applied Dec 18, 2023
andrwng
andrwng previously approved these changes Dec 18, 2023
Copy link
Contributor

@andrwng andrwng left a comment

Choose a reason for hiding this comment

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

I think these changes look good. Would be great to have some tests

src/v/config/config_store.h Outdated Show resolved Hide resolved
Copy link
Contributor

@andrwng andrwng left a comment

Choose a reason for hiding this comment

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

Thanks for adding some tests! There is probably more to be done, e.g. in ducktape tests, but I don't think that has to block this

@vbotbuildovich
Copy link
Collaborator

new failures in https://buildkite.com/redpanda/redpanda/builds/42986#018c7e88-7056-4487-ac0c-889b74651af3:

"rptest.tests.consumer_group_recovery_test.ConsumerOffsetsRecoveryTest.test_consumer_offsets_partition_recovery"

@piyushredpanda
Copy link
Contributor

Failure here seems to be #15261

@piyushredpanda piyushredpanda merged commit 8132430 into redpanda-data:dev Dec 19, 2023
17 of 19 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

delete_retention_ms migration is not working when included in redpanda.yaml
5 participants