qdb_event("Vetoing "<<req.describe(false)<<" because its lastIndex ("<<req.lastIndex<<") is before my log start ("<<journal.getLogStart()<<") - way too far behind me.");
qdb_event("Vetoing "<<reqDescr<<" because its lastIndex ("<<req.lastIndex<<") is before my log start ("<<journal.getLogStart()<<") - way too far behind me.");
// If the node were to ascend, it'll try and remove my req.lastIndex entry
// If the node were to ascend, it'll try and remove my req.lastIndex entry
// as inconsistent, which I consider committed already... Veto!
// as inconsistent, which I consider committed already... Veto!
if(req.lastTerm!=myLastIndexTerm){
if(req.lastTerm!=myLastIndexTerm){
qdb_event("Vetoing "<<req.describe(false)<<" because its ascension would overwrite my committed entry with index "<<req.lastIndex);
qdb_event("Vetoing "<<reqDescr<<" because its ascension would overwrite my committed entry with index "<<req.lastIndex);
return{snapshot->term,RaftVote::VETO};
return{snapshot->term,RaftVote::VETO};
}
}
if(req.lastIndex+1<=journal.getCommitIndex()){
if(req.lastIndex+1<=journal.getCommitIndex()){
// If the node were to ascend, it would add a leadership marker, and try
// If the node were to ascend, it would add a leadership marker, and try
// to remove my committed req.lastIndex+1 entry as conflicting. Veto!
// to remove my committed req.lastIndex+1 entry as conflicting. Veto!
qdb_event("Vetoing "<<req.describe(false)<<" because its ascension would overwrite my committed entry with index "<<req.lastIndex+1<<" through the addition of a leadership marker.");
qdb_event("Vetoing "<<reqDescr<<" because its ascension would overwrite my committed entry with index "<<req.lastIndex+1<<" through the addition of a leadership marker.");
return{snapshot->term,RaftVote::VETO};
return{snapshot->term,RaftVote::VETO};
}
}
}
}
if(snapshot->term!=req.term){
if(snapshot->term!=req.term){
qdb_event("Rejecting "<<req.describe(false)<<" because of a term mismatch: "<<snapshot->term<<" vs "<<req.term);
qdb_event("Rejecting "<<reqDescr<<" because of a term mismatch: "<<snapshot->term<<" vs "<<req.term);
qdb_event("Rejecting "<<req.describe(false)<<" since my journal is more up-to-date, based on last term: "<<myLastIndex<<","<<myLastTerm<<" vs "<<req.lastIndex<<","<<req.lastTerm);
qdb_event("Rejecting "<<reqDescr<<" since my journal is more up-to-date, based on last term: "<<myLastIndex<<","<<myLastTerm<<" vs "<<req.lastIndex<<","<<req.lastTerm);
qdb_event("Rejecting "<<req.describe(false)<<" since my journal is more up-to-date, based on last index: "<<myLastIndex<<","<<myLastTerm<<" vs "<<req.lastIndex<<","<<req.lastTerm);
qdb_event("Rejecting "<<reqDescr<<" since my journal is more up-to-date, based on last index: "<<myLastIndex<<","<<myLastTerm<<" vs "<<req.lastIndex<<","<<req.lastTerm);