Skip to content

Commit

Permalink
In replication scenario, entry_sm gets updated every time it is used.
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoliy Bilenko <[email protected]>
  • Loading branch information
Anatoliy Bilenko authored and Anatoliy Bilenko committed Nov 25, 2024
1 parent 6ba0bf8 commit 9539a2e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/raft/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,10 @@ int replicationApply(struct raft *r)
tracef("replicationApply - ENTRY NULL");
return 0;
}
struct sm *entry_sm = log_get_entry_sm(r->log, entry->term, index);
raft_term entry_sm_term = entry->term;
raft_index entry_sm_index = index;
struct sm *entry_sm = log_get_entry_sm(r->log, entry_sm_term,
entry_sm_index);
assert(entry_sm != NULL);

assert(entry->type == RAFT_COMMAND ||
Expand All @@ -1865,6 +1868,9 @@ int replicationApply(struct raft *r)
}

if (rv == 0) {
entry_sm = log_get_entry_sm(r->log, entry_sm_term,
entry_sm_index);
assert(entry_sm != NULL);
sm_move(entry_sm, ENTRY_APPLIED);
} else {
break;
Expand Down

0 comments on commit 9539a2e

Please sign in to comment.