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

[v23.2.x] Fix/v23.2.x/cfg unchecked test #15874

Merged

Conversation

andijcr
Copy link
Contributor

@andijcr andijcr commented Dec 22, 2023

cfg.get() can throw std::out_of_range if the name is not known by redpanda.

this can be the case for unknown properties that nonetheless gets written to the controller log, and later loaded again during startup

Backport of PR #15840

cfg.get() can throw std::out_of_range if the name is not known by
redpanda.

this can be the case for unknown properties that nonetheless gets
written to the controller log, and later loaded again during startup
@andijcr andijcr changed the title Fix/v23.2.x/cfg unchecked test [v23.2.x] Fix/v23.2.x/cfg unchecked test Dec 22, 2023
@andijcr andijcr marked this pull request as ready for review December 22, 2023 16:25
if (cfg.contains(key)) {
auto& property = cfg.get(key);
Copy link
Contributor

Choose a reason for hiding this comment

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

cfg can probably now go into if with init-statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can't, it would still throw std::out_of_range if no key is found

@andijcr andijcr merged commit 170827a into redpanda-data:v23.2.x Jan 5, 2024
25 checks passed
@andijcr andijcr deleted the fix/v23.2.x/cfg_unchecked_test branch January 5, 2024 10:52
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.

[v23.2.x] cluster/config_manager: protect cfg.get() behind cfg.contains()
2 participants