From cb4a6bf610fbd45fcf1e078a961a563aa5fd282f Mon Sep 17 00:00:00 2001 From: John Sully Date: Mon, 17 Feb 2020 23:29:03 -0500 Subject: [PATCH 1/8] C++14 build fix Former-commit-id: 5a3e3c9fe20dabe294c439cd2b22e929a228f596 --- src/ae.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ae.cpp b/src/ae.cpp index 25898007e..00926d9f5 100644 --- a/src/ae.cpp +++ b/src/ae.cpp @@ -131,7 +131,7 @@ struct aeCommand aeCommandControl *pctl; }; #ifdef PIPE_BUF -static_assert(sizeof(aeCommand) <= PIPE_BUF); +static_assert(sizeof(aeCommand) <= PIPE_BUF, "aeCommand must be small enough to send atomically through a pipe"); #endif void aeProcessCmd(aeEventLoop *eventLoop, int fd, void *, int ) From 5e885739ef19c02a7afede92fb2f05a98d92a07f Mon Sep 17 00:00:00 2001 From: John Sully Date: Mon, 17 Feb 2020 23:45:40 -0500 Subject: [PATCH 2/8] Change Redis to KeyDB Former-commit-id: 6ad6c1d780f26a0785f39586b074ac3bb3132e09 --- src/server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.cpp b/src/server.cpp index 6fee88732..8da8e650b 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4699,7 +4699,7 @@ void daemonize(void) { } void version(void) { - printf("Redis server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n", + printf("KeyDB server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n", KEYDB_REAL_VERSION, redisGitSHA1(), atoi(redisGitDirty()) > 0, From c33886e15277d8d9a5ef832cf9bea0fcff1b89ea Mon Sep 17 00:00:00 2001 From: John Sully Date: Mon, 17 Feb 2020 23:45:40 -0500 Subject: [PATCH 3/8] Change Redis to KeyDB Former-commit-id: 51ea3cf30ca99be8064fc95c8ddd0d61fdcc5c5d --- src/server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.cpp b/src/server.cpp index 12f388023..b7e845e20 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4800,7 +4800,7 @@ void daemonize(void) { } void version(void) { - printf("Redis server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n", + printf("KeyDB server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n", KEYDB_REAL_VERSION, redisGitSHA1(), atoi(redisGitDirty()) > 0, From 6ea90217735e56b2d92fe9c9e1705a929091a5a2 Mon Sep 17 00:00:00 2001 From: John Sully Date: Mon, 17 Feb 2020 23:45:40 -0500 Subject: [PATCH 4/8] Change Redis to KeyDB Former-commit-id: e6316c8106caa9103d2bef6af35721a0be87aae0 --- src/server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.cpp b/src/server.cpp index d35656290..f1791c107 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4952,7 +4952,7 @@ void daemonize(void) { } void version(void) { - printf("Redis server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n", + printf("KeyDB server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n", KEYDB_REAL_VERSION, redisGitSHA1(), atoi(redisGitDirty()) > 0, From 48ba6c173c8bbe452d63a5cb907b322afc2ebe4d Mon Sep 17 00:00:00 2001 From: John Sully Date: Wed, 26 Feb 2020 21:49:40 -0500 Subject: [PATCH 5/8] Fix crash propogating stale keys Former-commit-id: d95bead3837edeca11f27f6f344eca8174ca53e3 --- src/replication.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/replication.cpp b/src/replication.cpp index ba2008c0a..d7e92d308 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -278,7 +278,7 @@ void replicationFeedSlave(client *replica, int dictid, robj **argv, int argc, bo if (g_pserver->repl_backlog && fSendRaw) feedReplicationBacklogWithObject(selectcmd); /* Send it to slaves */ - addReply(replica,selectcmd); + addReplyAsync(replica,selectcmd); if (dictid < 0 || dictid >= PROTO_SHARED_SELECT_CMDS) decrRefCount(selectcmd); @@ -290,12 +290,12 @@ void replicationFeedSlave(client *replica, int dictid, robj **argv, int argc, bo * or are already in sync with the master. */ /* Add the multi bulk length. */ - addReplyArrayLen(replica,argc); + addReplyArrayLenAsync(replica,argc); /* Finally any additional argument that was not stored inside the * static buffer if any (from j to argc). */ for (int j = 0; j < argc; j++) - addReplyBulk(replica,argv[j]); + addReplyBulkAsync(replica,argv[j]); } /* Propagate write commands to slaves, and populate the replication backlog From 1db49c589799258103df8bb8579ab1d04531718b Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 28 Feb 2020 21:21:05 -0500 Subject: [PATCH 6/8] Fix issue #146 Former-commit-id: e5a2d594464a965f36e4cbf924f02929265186e6 --- src/fastlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fastlock.cpp b/src/fastlock.cpp index 4f8b2e6dc..788d84c97 100644 --- a/src/fastlock.cpp +++ b/src/fastlock.cpp @@ -335,7 +335,7 @@ extern "C" int fastlock_trylock(struct fastlock *lock, int fWeak) struct ticket ticket_expect { { { active, active } } }; struct ticket ticket_setiflocked { { { active, next } } }; - if (__atomic_compare_exchange(&lock->m_ticket, &ticket_expect, &ticket_setiflocked, fWeak /*weak*/, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) + if (__atomic_compare_exchange(&lock->m_ticket.u, &ticket_expect.u, &ticket_setiflocked.u, fWeak /*weak*/, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) { lock->m_depth = 1; tid = gettid(); From f68f3d0d14b3feb884e714da1b549e823533750d Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 28 Feb 2020 22:04:42 -0500 Subject: [PATCH 7/8] Fix not respecting max clients config, issue #147 Former-commit-id: 54c96d19954fbddcfd2a307e436ca3290c76e0fb --- src/server.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server.cpp b/src/server.cpp index 8da8e650b..837b1c38e 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -5121,10 +5121,6 @@ int main(int argc, char **argv) { dictSetHashFunctionSeed((uint8_t*)hashseed); g_pserver->sentinel_mode = checkForSentinelMode(argc,argv); initServerConfig(); - for (int iel = 0; iel < MAX_EVENT_LOOPS; ++iel) - { - initServerThread(g_pserver->rgthreadvar+iel, iel == IDX_EVENT_LOOP_MAIN); - } serverTL = &g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN]; aeAcquireLock(); // We own the lock on boot @@ -5251,6 +5247,10 @@ int main(int argc, char **argv) { int background = cserver.daemonize && !cserver.supervised; if (background) daemonize(); + for (int iel = 0; iel < MAX_EVENT_LOOPS; ++iel) + { + initServerThread(g_pserver->rgthreadvar+iel, iel == IDX_EVENT_LOOP_MAIN); + } initServer(); initNetworking(cserver.cthreads > 1 /* fReusePort */); From ec4eb534d7d5ba54a4c6b7230b255fa63be78c3a Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 28 Feb 2020 23:49:17 -0500 Subject: [PATCH 8/8] Fix compile failure on raspberry pi machines, issue #141 Former-commit-id: aaca32a5cd1bdb0314b4a57847938854b8a4fef2 --- src/fastlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fastlock.cpp b/src/fastlock.cpp index 788d84c97..49c0fb095 100644 --- a/src/fastlock.cpp +++ b/src/fastlock.cpp @@ -299,7 +299,7 @@ extern "C" void fastlock_lock(struct fastlock *lock) #if defined(__i386__) || defined(__amd64__) __asm__ __volatile__ ("pause"); -#elif defined(__arm__) +#elif defined(__aarch64__) __asm__ __volatile__ ("yield"); #endif if ((++cloops % 0x100000) == 0)