Skip to content

Commit

Permalink
Merge pull request #829 from Expensify/master
Browse files Browse the repository at this point in the history
Update expensify_prod branch
  • Loading branch information
rafecolton authored Jul 31, 2020
2 parents ef1b3e2 + b506c47 commit a9f1f6a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions sqlitecluster/SQLiteNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,23 @@ void SQLiteNode::replicate(SQLiteNode& node, Peer* peer, SData command, SQLite&
bool quorum = !SStartsWith(command["ID"], "ASYNC");
if (quorum) {
SINFO("Waiting on DB");
if (node._localCommitNotifier.waitFor(currentCount) != SQLiteSequentialNotifier::RESULT::COMPLETED) {
return;
while (true) {
SQLiteSequentialNotifier::RESULT result = node._localCommitNotifier.waitFor(currentCount);
if (result == SQLiteSequentialNotifier::RESULT::UNKNOWN) {
// This should be impossible.
SERROR("Got UNKNOWN result from waitFor, which shouldn't happen");
} else if (result == SQLiteSequentialNotifier::RESULT::COMPLETED) {
// Success case.
break;
} else if (result == SQLiteSequentialNotifier::RESULT::CANCELED) {
SINFO("_localCommitNotifier.waitFor canceled early, returning.");
return;
} else if (result == SQLiteSequentialNotifier::RESULT::CHECKPOINT_REQUIRED) {
SINFO("Checkpoint required while waiting for DB to come up-to-date. Just waiting again.");
continue;
} else {
SERROR("Got unhandled SQLiteSequentialNotifier::RESULT value, did someone update the enum without updating this block?");
}
}
}

Expand Down

0 comments on commit a9f1f6a

Please sign in to comment.