Skip to content

Commit

Permalink
Allow to work in 1-node configuration (for testing purpose)
Browse files Browse the repository at this point in the history
  • Loading branch information
resetius committed Mar 3, 2024
1 parent 06bcee7 commit 3cb2faa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/raft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ TMessageHolder<TAppendEntriesRequest> TRaft::CreateAppendEntries(uint32_t nodeId
for (auto i = prevIndex; i < lastIndex; i++) {
mes.Payload[j++] = State->Log[i];
}
// std::cout << "Send " << j << " entries to " << nodeId << "\n";
}
return mes;
}
Expand Down Expand Up @@ -410,6 +409,10 @@ void TRaft::LeaderTimeout(ITimeSource::Time now) {
}
}

if (Nservers == 1) {
VolatileState->CommitAdvance(Nservers, *State);
}

ProcessCommitted();
ProcessWaiting();
}
Expand Down

0 comments on commit 3cb2faa

Please sign in to comment.