raft: remove empty() from fsm_output

Nobody remembered to keep this function up to date when adding stuff to
`fsm_output`.

Turns out that it's not being used by any Raft logic but only in some
tests. That use case can now be replaced with `fsm::has_output()` which
is also being used by `raft::server` code.
This commit is contained in:
Kamil Braun
2024-01-15 15:54:48 +01:00
parent bf6d5309ca
commit 1824c12975
2 changed files with 2 additions and 9 deletions

View File

@@ -46,14 +46,6 @@ struct fsm_output {
bool state_changed = false;
// Set to true if a leadership transfer was aborted since the last output
bool abort_leadership_transfer;
// True if there is no new output
bool empty() const {
return !term_and_vote &&
log_entries.size() == 0 && messages.size() == 0 &&
committed.size() == 0 && !snp && snps_to_drop.empty() &&
!configuration && !max_read_id_with_quorum;
}
};
struct fsm_config {

View File

@@ -94,7 +94,8 @@ communicate_impl(std::function<bool()> stop_pred, raft_routing_map& map) {
has_traffic = false;
for (auto e : map) {
raft::fsm& from = *e.second;
for (auto output = from.get_output(); !output.empty(); output = from.get_output()) {
for (bool has_output = from.has_output(); has_output; has_output = from.has_output()) {
auto output = from.get_output();
if (stop_pred()) {
return;
}