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] [CORE-96]: admin/server fix set_log_level handling of overlapping expirations #18445

Conversation

andijcr
Copy link
Contributor

@andijcr andijcr commented May 13, 2024

Backport of PR #18397

first commit adapted for v23.2

Fixes #18436

@andijcr andijcr added the kind/backport PRs targeting a stable branch label May 13, 2024
@andijcr andijcr added this to the v23.2.x-next milestone May 13, 2024
@andijcr
Copy link
Contributor Author

andijcr commented May 13, 2024

/ci-repeat

_log_level_resets is a map<str, level_reset>, we want to extract the
next expiring level_reset to rearm the _log_level_timer.

previously we would extract the min_element based on the key (the logger
name)

so this sequence of actions
set log-level kafka trace 10
set log-level raft trace 10

only kafka would be expired, because once expired the next run would
pick again kafka, see that there is no expiration, and not rearm the
timer.
@andijcr andijcr force-pushed the vbotbuildovich/backport-18397-v23.2.x-221 branch from 84b87b5 to 6444718 Compare May 13, 2024 20:30
@andijcr
Copy link
Contributor Author

andijcr commented May 13, 2024

/ci-repeat

@andijcr andijcr force-pushed the vbotbuildovich/backport-18397-v23.2.x-221 branch from 6444718 to 8835ecd Compare May 14, 2024 08:56
@andijcr andijcr marked this pull request as ready for review May 14, 2024 08:56
@andijcr andijcr requested review from a team, aanthony-rp and oleiman and removed request for a team May 14, 2024 08:56
the test shows that this sequence of actions

set log-level admin-api-server trace 10
set log-level raft trace 10

works and both logger are reset after the expiry period
@andijcr andijcr force-pushed the vbotbuildovich/backport-18397-v23.2.x-221 branch from 8835ecd to e7c299a Compare May 14, 2024 08:59
Comment on lines -625 to +633
auto next = std::min_element(
_log_level_resets.begin(),
_log_level_resets.end(),
[](const auto& a, const auto& b) {
return a.second.expires < b.second.expires;
});

if (next != _log_level_resets.end()) {
_log_level_timer.arm(next->second.expires);
if (_log_level_resets.empty()) {
return;
}

auto reset_values = _log_level_resets | std::views::values;
auto& lvl_rst = *std::ranges::min_element(
reset_values, std::less<>{}, &level_reset::expires);
_log_level_timer.arm(lvl_rst.expires);
Copy link
Member

Choose a reason for hiding this comment

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

Is the original actually bugged? Seems like the motivating issue would have been isolated to v23.3+

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah you are right, i didn't notice that v23.2 has the correct comparator

@andijcr
Copy link
Contributor Author

andijcr commented May 14, 2024

closing this as the bug is not in v23.2

@andijcr andijcr closed this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/redpanda kind/backport PRs targeting a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants