Commit 06b80d38 authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

Stop asserting when the write tracker rejects an entry

This is a valid case: The raft term changes after retrieving
the state snapshot, but before inserting into the journal.

The journal correctly rejects the entry - we should simply
warn and report "unavailable" to the client.

Stalling writers until the leadership marker has been applied
makes this race far more common - stress tests were failing,
but the race itself was there even before.
parent ed236e8c
Pipeline #428282 passed with stages
in 29 minutes and 10 seconds
......@@ -333,8 +333,9 @@ LinkStatus RaftDispatcher::service(Connection *conn, RedisRequest &req) {
LogIndex index = journal.getLogSize();
if(!writeTracker.append(index, RaftEntry(snapshot->term, std::move(req)), conn->getQueue(), redisDispatcher)) {
qdb_throw("appending write for index = " << index <<
qdb_warn("appending write for index = " << index <<
" and term " << snapshot->term << " failed when servicing client request");
return conn->err("unavailable");
}
return 1;
......
......@@ -96,7 +96,7 @@ bool RaftWriteTracker::append(LogIndex index, RaftEntry &&entry, const std::shar
std::lock_guard<std::mutex> lock(mtx);
if(!journal.append(index, entry)) {
qdb_throw("appending to journal failed for index = " << index <<
qdb_warn("appending to journal failed for index = " << index <<
" and term " << entry.term << " when appending to write tracker");
return false;
}
......
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