From b06901a295b2c2d983fc63bb8bb56feef8b132ef Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 1 Dec 2019 18:17:33 -0500 Subject: [PATCH 1/6] Fix Issue #107 Former-commit-id: 98a928147ff55a4b7299f9c51637684eed307c41 --- src/aof.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/aof.cpp b/src/aof.cpp index 719b72ed9..d48b664d2 100644 --- a/src/aof.cpp +++ b/src/aof.cpp @@ -165,7 +165,10 @@ void aofRewriteBufferAppend(unsigned char *s, unsigned long len) { /* Install a file event to send data to the rewrite child if there is * not one already. */ - aeCreateRemoteFileEvent(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, g_pserver->aof_pipe_write_data_to_child, AE_WRITABLE, aofChildWriteDiffData, NULL, FALSE); + aePostFunction(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, []{ + if (g_pserver->aof_pipe_write_data_to_child >= 0) + aeCreateFileEvent(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, g_pserver->aof_pipe_write_data_to_child, AE_WRITABLE, aofChildWriteDiffData, NULL); + }); } /* Write the buffer (possibly composed of multiple blocks) into the specified @@ -1566,6 +1569,7 @@ void aofClosePipes(void) { aeDeleteFileEventAsync(serverTL->el,fdAofWritePipe,AE_WRITABLE); close(fdAofWritePipe); }); + g_pserver->aof_pipe_write_data_to_child = -1; close(g_pserver->aof_pipe_read_data_from_parent); close(g_pserver->aof_pipe_write_ack_to_parent); From 56a28a7c1efe88eb369832d71d83de27ce91fcef Mon Sep 17 00:00:00 2001 From: "Tais P. Hansen" Date: Mon, 9 Dec 2019 13:48:08 +0100 Subject: [PATCH 2/6] Fix keydb-cli crashing on read-only filesystem Former-commit-id: 91eac2cdb32d5cd5eb9c1fc54244da08faf8d9e7 --- src/redis-cli.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/redis-cli.c b/src/redis-cli.c index ea920569d..7a1f06341 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -6594,6 +6594,8 @@ static char *fetchMOTDFromCache() static void setMOTDCache(const char *sz) { FILE *pf = fopen(szMotdCachePath(), "wb"); + if (pf == NULL) + return; size_t celem = fwrite(sz, strlen(sz), 1, pf); (void)celem; // best effort fclose(pf); From a319e8a4f4910f7a2ca7951ec1ebc6327037a6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Mon, 16 Dec 2019 13:00:22 +0100 Subject: [PATCH 3/6] readme: fix typo Former-commit-id: 7a3f363f34e3c295b1af6860ca681ca561026f1f --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 538aaf3c2..8d8c59ff0 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ What is KeyDB? KeyDB is a high performance fork of Redis with a focus on multithreading, memory efficiency, and high throughput. In addition to multithreading, KeyDB also has features only available in Redis Enterprise such as [Active Replication](https://github.com/JohnSully/KeyDB/wiki/Active-Replication), [FLASH storage](https://github.com/JohnSully/KeyDB/wiki/FLASH-Storage) support, and some not available at all such as direct backup to AWS S3. -KeyDB maintains full compatibility with the Redis protocol, modules, and scripts. This includes the atomicity gurantees for scripts and transactions. Because KeyDB keeps in sync with Redis development KeyDB is a superset of Redis functionality, making KeyDB a drop in replacement for existing Redis deployments. +KeyDB maintains full compatibility with the Redis protocol, modules, and scripts. This includes the atomicity guarantees for scripts and transactions. Because KeyDB keeps in sync with Redis development KeyDB is a superset of Redis functionality, making KeyDB a drop in replacement for existing Redis deployments. On the same hardware KeyDB can perform twice as many queries per second as Redis, with 60% lower latency. Active-Replication simplifies hot-spare failover allowing you to easily distribute writes over replicas and use simple TCP based load balancing/failover. KeyDB's higher performance allows you to do more on less hardware which reduces operation costs and complexity. From c8ca8b2ab8e07dd1ce922c18b80ad42a117d07df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Thu, 12 Dec 2019 14:25:20 +0100 Subject: [PATCH 4/6] Correct C++ related makefile variables FINAL_CXXFLAGS should not inherit CFLAGS because they can contain C specific options unsupported by C++. REDIS_CXX should point to the C++ compiler rather than C. Former-commit-id: 67f32bf1b1c1fd6e1dc72df90c86b1a9c1bee7a8 --- src/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 9d4c22cf3..dfa93ffd2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -101,7 +101,7 @@ endif -include .make-settings FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(REDIS_CFLAGS) -FINAL_CXXFLAGS=$(CXX_STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(CXXFLAGS) $(REDIS_CFLAGS) +FINAL_CXXFLAGS=$(CXX_STD) $(WARN) $(OPT) $(DEBUG) $(CXXFLAGS) $(REDIS_CFLAGS) FINAL_LDFLAGS=$(LDFLAGS) $(REDIS_LDFLAGS) $(DEBUG) FINAL_LIBS=-lm DEBUG=-g -ggdb @@ -187,7 +187,7 @@ ifeq ($(MALLOC),memkind) endif REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS) -REDIS_CXX=$(QUIET_CC)$(CC) $(FINAL_CXXFLAGS) +REDIS_CXX=$(QUIET_CC)$(CXX) $(FINAL_CXXFLAGS) KEYDB_AS=$(QUIET_CC) as --64 -g REDIS_LD=$(QUIET_LINK)$(CXX) $(FINAL_LDFLAGS) REDIS_INSTALL=$(QUIET_INSTALL)$(INSTALL) From ca6a26f1157f19658917608b523e8d4fcfca6fa8 Mon Sep 17 00:00:00 2001 From: John Sully Date: Tue, 17 Dec 2019 17:49:51 -0500 Subject: [PATCH 5/6] Enusre CXXFLAGS has the same settings as CFLAGS Former-commit-id: cda8d42a7656138e15788f262663a67ca4d8bc49 --- src/Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index dfa93ffd2..7e8bd534a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -74,9 +74,11 @@ endif # To get ARM stack traces if Redis crashes we need a special C flag. ifneq (,$(filter aarch64 armv,$(uname_M))) CFLAGS+=-funwind-tables + CXXFLAGS+=-funwind-tables else ifneq (,$(findstring armv,$(uname_M))) CFLAGS+=-funwind-tables + CXXFLAGS+=-funwind-tables endif endif @@ -110,13 +112,15 @@ ifeq ($(uname_S),SunOS) # SunOS ifneq ($(@@),32bit) CFLAGS+= -m64 + CXXFLAGS+= -m64 LDFLAGS+= -m64 endif DEBUG=-g DEBUG_FLAGS=-g - export CFLAGS LDFLAGS DEBUG DEBUG_FLAGS + export CFLAGS CXXFLAGS LDFLAGS DEBUG DEBUG_FLAGS INSTALL=cp -pf FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6 + FINAL_CXXFLAGS+= -D__EXTENSIONS__ -D_XPG6 FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt else ifeq ($(uname_S),Darwin) @@ -133,6 +137,7 @@ ifeq ($(uname_S),OpenBSD) FINAL_LIBS+= -lpthread ifeq ($(USE_BACKTRACE),yes) FINAL_CFLAGS+= -DUSE_BACKTRACE -I/usr/local/include + FINAL_CXXFLAGS+= -DUSE_BACKTRACE -I/usr/local/include FINAL_LDFLAGS+= -L/usr/local/lib FINAL_LIBS+= -lexecinfo endif @@ -150,6 +155,7 @@ else FINAL_LDFLAGS+= -rdynamic FINAL_LIBS+=-ldl -pthread -lrt -luuid FINAL_CFLAGS += -DMOTD + FINAL_CXXFLAGS += -DMOTD endif endif endif @@ -235,10 +241,13 @@ persist-settings: distclean echo OPT=$(OPT) >> .make-settings echo MALLOC=$(MALLOC) >> .make-settings echo CFLAGS=$(CFLAGS) >> .make-settings + echo CXXFLAGS=$(CXXFLAGS) >> .make-settings echo LDFLAGS=$(LDFLAGS) >> .make-settings echo REDIS_CFLAGS=$(REDIS_CFLAGS) >> .make-settings + echo REDIS_CXXFLAGS=$(REDIS_CXXFLAGS) >> .make-settings echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings + echo PREV_FINAL_CXXLAGS=$(FINAL_CXXFLAGS) >> .make-settings echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings -(cd modules && $(MAKE)) -(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS)) @@ -249,6 +258,8 @@ persist-settings: distclean # Clean everything, persist settings and build dependencies if anything changed ifneq ($(strip $(PREV_FINAL_CFLAGS)), $(strip $(FINAL_CFLAGS))) .make-prerequisites: persist-settings +else ifneq ($(strip $(PREV_FINAL_CXXFLAGS)), $(strip $(FINAL_CXXFLAGS))) +.make-prerequisites: persist-settings else ifneq ($(strip $(PREV_FINAL_LDFLAGS)), $(strip $(FINAL_LDFLAGS))) .make-prerequisites: persist-settings else @@ -334,7 +345,7 @@ bench: $(REDIS_BENCHMARK_NAME) @echo "" @echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386" @echo "" - $(MAKE) CFLAGS="-m32" LDFLAGS="-m32" + $(MAKE) CXXFLAGS="-m32" CFLAGS="-m32" LDFLAGS="-m32" gcov: $(MAKE) REDIS_CFLAGS="-fprofile-arcs -ftest-coverage -DCOVERAGE_TEST" REDIS_LDFLAGS="-fprofile-arcs -ftest-coverage" From 8844174763c21b40673767174569ebc6003f3618 Mon Sep 17 00:00:00 2001 From: John Sully Date: Tue, 17 Dec 2019 18:23:19 -0500 Subject: [PATCH 6/6] Fix type in makefile Former-commit-id: aa3e70f9a0b57da351ca940e40ca9422bdfcd26e --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 7e8bd534a..b8b09bf45 100644 --- a/src/Makefile +++ b/src/Makefile @@ -247,7 +247,7 @@ persist-settings: distclean echo REDIS_CXXFLAGS=$(REDIS_CXXFLAGS) >> .make-settings echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings - echo PREV_FINAL_CXXLAGS=$(FINAL_CXXFLAGS) >> .make-settings + echo PREV_FINAL_CXXFLAGS=$(FINAL_CXXFLAGS) >> .make-settings echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings -(cd modules && $(MAKE)) -(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS))