Skip to content

Commit 56ed20a

Browse files
committed
Prevent Raft followers from applying entries which they have not received yet.
1 parent 1552662 commit 56ed20a

File tree

1 file changed

+1
-1
lines changed
  • contrib/raftable/raft/src

1 file changed

+1
-1
lines changed

contrib/raftable/raft/src/raft.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ bool raft_peer_up(raft_t r, int id, char *host, int port, bool self) {
320320
static int raft_apply(raft_t raft) {
321321
int applied_now = 0;
322322
raft_log_t *l = &raft->log;
323-
while (l->applied < l->acked) {
323+
while ((l->applied < l->acked) && (l->applied <= RAFT_LOG_LAST_INDEX(raft))) {
324324
raft_entry_t *e = &RAFT_LOG(raft, l->applied);
325325
assert(e->update.len == e->bytes);
326326
raft->config.applier(raft->config.userdata, e->update, false);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy