From 359e871737f288366383fd57a85a3404c9c1f906 Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 19 Apr 2019 19:36:47 -0400 Subject: [PATCH] RREPLAY PERF: The UUID stack is unnecessary, RREPLAY itself can detect the cycle and call cancel() Former-commit-id: b276d803d49339eb30879a3d170ebc480d9430bd --- src/replication.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/replication.cpp b/src/replication.cpp index 75cdca40d..950e1819e 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -3145,22 +3145,15 @@ redisMaster *MasterInfoFromClient(client *c) class ReplicaNestState { public: - bool FPush(unsigned char *uuid) + bool FPush() { if (m_cnesting == REPLAY_MAX_NESTING) { m_fCancelled = true; return false; // overflow } - for (int i = 0; i < m_cnesting; ++i) - { - if (FUuidEqual(m_stackUUID[i], uuid)) { - m_fCancelled = true; - return false; // cycle detected - } - } + if (m_cnesting == 0) m_fCancelled = false; - memcpy(m_stackUUID[m_cnesting], uuid, UUID_BINARY_LEN); ++m_cnesting; return true; } @@ -3188,7 +3181,6 @@ public: private: int m_cnesting = 0; bool m_fCancelled = false; - unsigned char m_stackUUID[REPLAY_MAX_NESTING][UUID_BINARY_LEN]; }; void replicaReplayCommand(client *c) @@ -3239,7 +3231,7 @@ void replicaReplayCommand(client *c) return; // Our own commands have come back to us. Ignore them. } - if (!s_pstate->FPush(uuid)) + if (!s_pstate->FPush()) return; // OK We've recieved a command lets execute