-
Notifications
You must be signed in to change notification settings - Fork 592
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
Implemented raft::state_machine_manager
#12685
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnwat
reviewed
Aug 10, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeh this is starting to look nice!
mmaslankaprv
force-pushed
the
stm-manager
branch
4 times, most recently
from
August 17, 2023 06:32
b15dea0
to
cd233bc
Compare
mmaslankaprv
force-pushed
the
stm-manager
branch
8 times, most recently
from
August 22, 2023 16:21
eb81b62
to
063fcba
Compare
emaxerrno
reviewed
Aug 22, 2023
mmaslankaprv
force-pushed
the
stm-manager
branch
7 times, most recently
from
August 25, 2023 12:05
8b6762e
to
c67fd3f
Compare
mmaslankaprv
force-pushed
the
stm-manager
branch
2 times, most recently
from
August 30, 2023 10:28
0661a06
to
278b82d
Compare
mmaslankaprv
force-pushed
the
stm-manager
branch
from
September 4, 2023 16:56
0bbdda5
to
46fd591
Compare
rockwotj
previously approved these changes
Sep 5, 2023
* If an apply timed out (took long time) the stm may already advanced | ||
* past what was requested to read | ||
*/ | ||
if (state.stm_entry->stm->next() > batch.base_offset()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this assumption be documented anywhere? Maybe in state_machine_base.h
?
mmaslankaprv
force-pushed
the
stm-manager
branch
from
September 5, 2023 07:02
46fd591
to
14bfa0a
Compare
Signed-off-by: Michal Maslanka <michal@redpanda.com>
Signed-off-by: Michal Maslanka <michal@redpanda.com>
State machine manager is an entry point for registering state machines built on top of replicated log. State machine managers uses a single fiber to read and apply record batches to all managed state machines. When a machine throws an exception or timeouts when applying batches to its state subsequent applies are executed in the separate apply fiber specific for that STM. State machine manager also takes care of the snapshot consistency. It wraps state machine snapshots in its own snapshot format which is a map where each individual STM snapshot is stored separately. When snapshot is taken the manager guarantees that all the STMs have the same offset applied so that the snapshot is consistent across the state machines. Signed-off-by: Michal Maslanka <michal@redpanda.com>
Added simple test fixture allowing to create a raft containing multiple nodes. The fixture uses in memory protocol implementation that in future will allow us to inject arbitrary failures into communication layer. Signed-off-by: Michal Maslanka <michal@redpanda.com>
Signed-off-by: Michal Maslanka <michal@redpanda.com>
Signed-off-by: Michal Maslanka <michal@redpanda.com>
Replaced `ss::shared_promise` with `ss::condition_variable` Signed-off-by: Michal Maslanka <michal@redpanda.com>
Signed-off-by: Michal Maslanka <michal@redpanda.com>
Signed-off-by: Michal Maslanka <michal@redpanda.com>
The base class i.e. `raft::state_machine` already have a raft pointer it is pointless to store it once again in `persisted_stm`. Signed-off-by: Michal Maslanka <michal@redpanda.com>
Signed-off-by: Michal Maslanka <michal@redpanda.com>
Made `cluster::persited_stm` managable with `state_machine_manager`. This way all the state machines will share the same fiber reading and applying batches. Signed-off-by: Michal Maslanka <michal@redpanda.com>
Reoved `_insync_offset` from `cluster::persisted_stm` tracking this offset was redundant to `_next` as it is always offset previous to `_next` and can be replaced with `last_applied_offset()` Signed-off-by: Michal Maslanka <michal@redpanda.com>
The error may happen as a natural consequence of a race condition between two segments uploads. It shouldn't make the tests to fail Signed-off-by: Michal Maslanka <michal@redpanda.com>
mmaslankaprv
force-pushed
the
stm-manager
branch
from
September 5, 2023 11:57
14bfa0a
to
80b92f8
Compare
rockwotj
approved these changes
Sep 5, 2023
ci-failure: #13181 |
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
State Machine Manager
Implemented
raft::state_machine_manager
. State machine manager is supposed to be an entry point for creating state machines built on top of data partition. All managed state machines must implementstate_machine_base
interface. The state machine manager uses a single fiber to apply batches to all managed state machines without copyingmodel::record_batch
and reading it multiple times. Additionally a manager is responsible for applying and taking Raft snapshots.Backports Required
Release Notes