Skip to content

Commit

Permalink
r/consensus: expose learner start offset from consensus
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Oct 3, 2023
1 parent b29235a commit 65d9655
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/v/raft/consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3846,4 +3846,13 @@ void consensus::upsert_recovery_state(
}
}

std::optional<model::offset> consensus::get_learner_start_offset() const {
const auto& latest_cfg = _configuration_manager.get_latest();

if (latest_cfg.get_configuration_update()) {
return latest_cfg.get_configuration_update()->learner_start_offset;
}
return std::nullopt;
}

} // namespace raft
2 changes: 2 additions & 0 deletions src/v/raft/consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ class consensus {
model::offset leader_last_offset,
bool already_recovering);

std::optional<model::offset> get_learner_start_offset() const;

bool use_serde_configuration() const {
return _features.is_active(features::feature::raft_config_serde);
}
Expand Down

0 comments on commit 65d9655

Please sign in to comment.