Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update expensify_prod branch #1900

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions sqlitecluster/SQLiteNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,6 @@ bool SQLiteNode::update() {
SASSERTWARN(!_syncPeer);
SASSERTWARN(!_leadPeer);
SASSERTWARN(_db.getUncommittedHash().empty());
// Wait for everyone to respond
bool allResponded = true;
size_t numFullPeers = 0;
size_t numLoggedInFullPeers = 0;
size_t approveCount = 0;
Expand All @@ -849,9 +847,7 @@ bool SQLiteNode::update() {

// Has it responded yet?
if (peer->standupResponse == SQLitePeer::Response::NONE) {
// At least one logged in full peer hasn't responded
allResponded = false;
break;
// This peer hasn't yet responded. We do nothing with it in this case, maybe it will have responded by the next check.
} else if (peer->standupResponse == SQLitePeer::Response::ABSTAIN) {
PHMMM("Peer abstained from participation in quorum");
abstainCount++;
Expand Down Expand Up @@ -880,9 +876,9 @@ bool SQLiteNode::update() {
// If everyone's responded with approval and we form a majority, then finish standup.
bool majorityConnected = numLoggedInFullPeers * 2 >= numFullPeers;
bool quorumApproved = approveCount * 2 >= numFullPeers;
if (allResponded && majorityConnected && quorumApproved) {
if (majorityConnected && quorumApproved) {
// Complete standup
SINFO("All peers responded, going LEADING.");
SINFO("Enough peers responded, going LEADING.");
_changeState(SQLiteNodeState::LEADING);
return true; // Re-update
}
Expand Down