Skip to content

Commit

Permalink
r/configuration_manager: fixed order in which state is deleted
Browse files Browse the repository at this point in the history
Previously when group configuration manager persistent state was deleted
we removed configuration map first. If node would crash after the
configuration map was deleted but before deleting the highest known
offset configuration would never be recovered from the log since raft
uses highest known offset as a hint when recovering state during
bootstrap. Fixed problem by removing the highest known offset first,
this way when partial remove will happen raft will still be able to
recover configurations from the log.

Signed-off-by: Michal Maslanka <michal@vectorized.io>
(cherry picked from commit 7f76c89)
  • Loading branch information
mmaslankaprv committed Nov 24, 2021
1 parent c508c8b commit bcc20e8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/v/raft/configuration_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -413,15 +413,16 @@ ss::future<offset_configuration> configuration_manager::wait_for_change(

ss::future<> configuration_manager::remove_persistent_state() {
return _storage.kvs()
.remove(storage::kvstore::key_space::consensus, configurations_map_key())
.remove(
storage::kvstore::key_space::consensus, highest_known_offset_key())
.then([this] {
return _storage.kvs().remove(
storage::kvstore::key_space::consensus, highest_known_offset_key());
storage::kvstore::key_space::consensus,
next_configuration_idx_key());
})
.then([this] {
return _storage.kvs().remove(
storage::kvstore::key_space::consensus,
next_configuration_idx_key());
storage::kvstore::key_space::consensus, configurations_map_key());
});
}

Expand Down

0 comments on commit bcc20e8

Please sign in to comment.