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

[v24.1.x] Fixed state_machine_manager stall #18638

Conversation

vbotbuildovich
Copy link
Collaborator

Backport of PR #18626

If neither of state machines managed by the state machine manager can
accept the foreground apply there is no need to read the range of
batches from the log. In this case we can skip the foreground apply read
and move on directly to background apply dispatch.

Signed-off-by: Michał Maślanka <michal@redpanda.com>
(cherry picked from commit 08af2b2)
If an apply results in error the stm manager should yield to prevent
busy looping and consuming a lot of CPU cycles. Fixed yielding in
background apply fiber and added a yield if foreground apply didn't make
progress.

Signed-off-by: Michał Maślanka <michal@redpanda.com>
(cherry picked from commit e121770)
In state machine manager the background apply fiber is there to apply
batches to state machines which are behind the main apply fiber. The
background apply fiber is only active if an stm is behind what is
currently being applied by the main fiber. A bug in reader configuration
lead to a situation in which a background apply could read up to `_next`
offset of the state machine manager leading to the situation in which a
stm `last_applied_offset` is equal to `_next` therefore the stm next
offset is actually equal to `state_machine_manager::_next + 1`. This
lead to a situation in which there may be no stms suitable to be
handled in main apply fiber but also they are not recoverable by
background apply fiber as their `_next` offset is greater of the one
from the state machine manager. This causes a stall in the
`state_machine_manager` and state machines stop making progress.

Signed-off-by: Michał Maślanka <michal@redpanda.com>
(cherry picked from commit 0f8963c)
Signed-off-by: Michał Maślanka <michal@redpanda.com>
(cherry picked from commit 139823e)
Signed-off-by: Michał Maślanka <michal@redpanda.com>
(cherry picked from commit 1abe995)
@vbotbuildovich vbotbuildovich added this to the v24.1.x-next milestone May 23, 2024
@vbotbuildovich vbotbuildovich added the kind/backport PRs targeting a stable branch label May 23, 2024
@piyushredpanda piyushredpanda merged commit 5ff21da into redpanda-data:v24.1.x May 23, 2024
18 checks passed
@piyushredpanda piyushredpanda modified the milestones: v24.1.x-next, v24.1.3 May 23, 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.

3 participants