From a3323d2b5bad3a4064ba8babb0ad2c0a2cc75800 Mon Sep 17 00:00:00 2001 From: John Sully Date: Tue, 27 Oct 2020 01:54:13 +0000 Subject: [PATCH] Fix multithreaded test failure Former-commit-id: 1840601f8efb27174efa0a66f78de8c490b5bba4 --- src/server.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/server.cpp b/src/server.cpp index 3cf0b0189..13086037d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3540,6 +3540,12 @@ void call(client *c, int flags) { replicationFeedMonitors(c,g_pserver->monitors,c->db->id,c->argv,c->argc); } + /* We need to transfer async writes before a client's repl state gets changed. Otherwise + we won't be able to propogate them correctly. */ + if (c->cmd->flags & CMD_CATEGORY_REPLICATION) { + ProcessPendingAsyncWrites(); + } + /* Initialization: clear the flags that must be set by the command on * demand, and initialize the array for additional commands propagation. */ c->flags &= ~(CLIENT_FORCE_AOF|CLIENT_FORCE_REPL|CLIENT_PREVENT_PROP);