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

Simply retry requests rejected by the write tracker

And add a comment detailing what's going on.
parent 06b80d38
Pipeline #428482 passed with stages
in 30 minutes and 25 seconds
......@@ -333,9 +333,12 @@ 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_warn("appending write for index = " << index <<
" and term " << snapshot->term << " failed when servicing client request");
return conn->err("unavailable");
// We were most likely hit by the following race:
// - We retrieved the state snapshot.
// - The raft term was changed in the meantime, we lost leadership.
// - The journal rejected the entry due to term mismatch.
// Let's simply retry.
return this->service(conn, req);
}
return 1;
......
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