From 78b87d4ed1ed0826dc971cfa57a9a1bb2ec23cdc Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 31 Jan 2021 02:30:28 +0000 Subject: [PATCH] Fix crash on shutdown command Former-commit-id: d72b5fa16df0c41dd62b8b6d25c1c2c9cce8b413 --- src/networking.cpp | 2 ++ src/server.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/networking.cpp b/src/networking.cpp index d33be6923..f1ec92bbe 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -3295,6 +3295,8 @@ void flushSlavesOutputBuffers(void) { listIter li; listNode *ln; + flushReplBacklogToClients(); + listRewind(g_pserver->slaves,&li); while((ln = listNext(&li))) { client *replica = (client*)listNodeValue(ln); diff --git a/src/server.cpp b/src/server.cpp index 554c0ac43..8a7184398 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4203,6 +4203,8 @@ int prepareForShutdown(int flags) { /* Best effort flush of replica output buffers, so that we hopefully * send them pending writes. */ flushSlavesOutputBuffers(); + g_pserver->repl_batch_idxStart = -1; + g_pserver->repl_batch_offStart = -1; /* Close the listening sockets. Apparently this allows faster restarts. */ closeListeningSockets(1);