Commit f03b5eea authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

raft: drop unused struct

parent 38c2ef10
Pipeline #1560309 passed with stages
in 118 minutes and 38 seconds
......@@ -127,20 +127,19 @@ void RaftDirector::runForLeader() {
// it could have changed in-between
RaftStateSnapshotPtr snapshot = state.getSnapshot();
// advance the term by one, become a candidate.
if(!state.observed(snapshot->term+1, {})) return;
if(!state.becomeCandidate(snapshot->term+1)) return;
// prepare vote request
RaftVoteRequest votereq;
votereq.term = snapshot->term+1;
votereq.lastIndex = journal.getLogSize()-1;
if(!journal.fetch(votereq.lastIndex, votereq.lastTerm).ok()) {
qdb_critical("Unable to fetch journal entry " << votereq.lastIndex << " when running for leader");
state.dropOut(snapshot->term+1);
return;
}
// advance the term by one, become a candidate.
if(!state.observed(snapshot->term+1, {})) return;
if(!state.becomeCandidate(snapshot->term+1)) return;
ElectionOutcome electionOutcome = RaftElection::perform(votereq, state, lease, contactDetails);
if(electionOutcome != ElectionOutcome::kElected) {
......
......@@ -48,14 +48,6 @@ public:
static bool fetchLastResponse(const qclient::redisReplyPtr &source, std::vector<RaftEntry> &entries);
};
struct ElectionSingleTally {
bool timeout;
bool error;
RaftVoteResponse resp;
};
using ElectionTally = std::map<RaftServer, ElectionSingleTally>;
class RaftElection {
public:
static ElectionOutcome perform(RaftVoteRequest votereq, RaftState &state, RaftLease &lease, const RaftContactDetails &contactDetails);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment