Merge branch 'unstable' into advanced_db

Former-commit-id: 1f9cb22fd370741c2f60517376af5008c25704f5
This commit is contained in:
John Sully 2019-12-17 19:00:02 -05:00
commit a0d8d52ef3
4 changed files with 22 additions and 5 deletions

View File

@ -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 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. 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.

View File

@ -74,9 +74,11 @@ endif
# To get ARM stack traces if Redis crashes we need a special C flag. # To get ARM stack traces if Redis crashes we need a special C flag.
ifneq (,$(filter aarch64 armv,$(uname_M))) ifneq (,$(filter aarch64 armv,$(uname_M)))
CFLAGS+=-funwind-tables CFLAGS+=-funwind-tables
CXXFLAGS+=-funwind-tables
else else
ifneq (,$(findstring armv,$(uname_M))) ifneq (,$(findstring armv,$(uname_M)))
CFLAGS+=-funwind-tables CFLAGS+=-funwind-tables
CXXFLAGS+=-funwind-tables
endif endif
endif endif
@ -101,7 +103,7 @@ endif
-include .make-settings -include .make-settings
FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(REDIS_CFLAGS) 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_LDFLAGS=$(LDFLAGS) $(REDIS_LDFLAGS) $(DEBUG)
FINAL_LIBS=-lm -lz -latomic FINAL_LIBS=-lm -lz -latomic
DEBUG=-g -ggdb DEBUG=-g -ggdb
@ -110,13 +112,15 @@ ifeq ($(uname_S),SunOS)
# SunOS # SunOS
ifneq ($(@@),32bit) ifneq ($(@@),32bit)
CFLAGS+= -m64 CFLAGS+= -m64
CXXFLAGS+= -m64
LDFLAGS+= -m64 LDFLAGS+= -m64
endif endif
DEBUG=-g DEBUG=-g
DEBUG_FLAGS=-g DEBUG_FLAGS=-g
export CFLAGS LDFLAGS DEBUG DEBUG_FLAGS export CFLAGS CXXFLAGS LDFLAGS DEBUG DEBUG_FLAGS
INSTALL=cp -pf INSTALL=cp -pf
FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6 FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6
FINAL_CXXFLAGS+= -D__EXTENSIONS__ -D_XPG6
FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt
else else
ifeq ($(uname_S),Darwin) ifeq ($(uname_S),Darwin)
@ -133,6 +137,7 @@ ifeq ($(uname_S),OpenBSD)
FINAL_LIBS+= -lpthread FINAL_LIBS+= -lpthread
ifeq ($(USE_BACKTRACE),yes) ifeq ($(USE_BACKTRACE),yes)
FINAL_CFLAGS+= -DUSE_BACKTRACE -I/usr/local/include FINAL_CFLAGS+= -DUSE_BACKTRACE -I/usr/local/include
FINAL_CXXFLAGS+= -DUSE_BACKTRACE -I/usr/local/include
FINAL_LDFLAGS+= -L/usr/local/lib FINAL_LDFLAGS+= -L/usr/local/lib
FINAL_LIBS+= -lexecinfo FINAL_LIBS+= -lexecinfo
endif endif
@ -150,6 +155,7 @@ else
FINAL_LDFLAGS+= -rdynamic FINAL_LDFLAGS+= -rdynamic
FINAL_LIBS+=-ldl -pthread -lrt -luuid FINAL_LIBS+=-ldl -pthread -lrt -luuid
FINAL_CFLAGS += -DMOTD FINAL_CFLAGS += -DMOTD
FINAL_CXXFLAGS += -DMOTD
endif endif
endif endif
endif endif
@ -236,10 +242,13 @@ persist-settings: distclean
echo OPT=$(OPT) >> .make-settings echo OPT=$(OPT) >> .make-settings
echo MALLOC=$(MALLOC) >> .make-settings echo MALLOC=$(MALLOC) >> .make-settings
echo CFLAGS=$(CFLAGS) >> .make-settings echo CFLAGS=$(CFLAGS) >> .make-settings
echo CXXFLAGS=$(CXXFLAGS) >> .make-settings
echo LDFLAGS=$(LDFLAGS) >> .make-settings echo LDFLAGS=$(LDFLAGS) >> .make-settings
echo REDIS_CFLAGS=$(REDIS_CFLAGS) >> .make-settings echo REDIS_CFLAGS=$(REDIS_CFLAGS) >> .make-settings
echo REDIS_CXXFLAGS=$(REDIS_CXXFLAGS) >> .make-settings
echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings
echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings
echo PREV_FINAL_CXXFLAGS=$(FINAL_CXXFLAGS) >> .make-settings
echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings
-(cd modules && $(MAKE)) -(cd modules && $(MAKE))
-(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS)) -(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS))
@ -250,6 +259,8 @@ persist-settings: distclean
# Clean everything, persist settings and build dependencies if anything changed # Clean everything, persist settings and build dependencies if anything changed
ifneq ($(strip $(PREV_FINAL_CFLAGS)), $(strip $(FINAL_CFLAGS))) ifneq ($(strip $(PREV_FINAL_CFLAGS)), $(strip $(FINAL_CFLAGS)))
.make-prerequisites: persist-settings .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))) else ifneq ($(strip $(PREV_FINAL_LDFLAGS)), $(strip $(FINAL_LDFLAGS)))
.make-prerequisites: persist-settings .make-prerequisites: persist-settings
else else
@ -337,7 +348,7 @@ bench: $(REDIS_BENCHMARK_NAME)
@echo "" @echo ""
@echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386" @echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386"
@echo "" @echo ""
$(MAKE) CFLAGS="-m32" LDFLAGS="-m32" $(MAKE) CXXFLAGS="-m32" CFLAGS="-m32" LDFLAGS="-m32"
gcov: gcov:
$(MAKE) REDIS_CFLAGS="-fprofile-arcs -ftest-coverage -DCOVERAGE_TEST" REDIS_LDFLAGS="-fprofile-arcs -ftest-coverage" $(MAKE) REDIS_CFLAGS="-fprofile-arcs -ftest-coverage -DCOVERAGE_TEST" REDIS_LDFLAGS="-fprofile-arcs -ftest-coverage"

View File

@ -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 /* Install a file event to send data to the rewrite child if there is
* not one already. */ * 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 /* Write the buffer (possibly composed of multiple blocks) into the specified
@ -1567,6 +1570,7 @@ void aofClosePipes(void) {
aeDeleteFileEventAsync(serverTL->el,fdAofWritePipe,AE_WRITABLE); aeDeleteFileEventAsync(serverTL->el,fdAofWritePipe,AE_WRITABLE);
close(fdAofWritePipe); 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_read_data_from_parent);
close(g_pserver->aof_pipe_write_ack_to_parent); close(g_pserver->aof_pipe_write_ack_to_parent);

View File

@ -6594,6 +6594,8 @@ static char *fetchMOTDFromCache()
static void setMOTDCache(const char *sz) static void setMOTDCache(const char *sz)
{ {
FILE *pf = fopen(szMotdCachePath(), "wb"); FILE *pf = fopen(szMotdCachePath(), "wb");
if (pf == NULL)
return;
size_t celem = fwrite(sz, strlen(sz), 1, pf); size_t celem = fwrite(sz, strlen(sz), 1, pf);
(void)celem; // best effort (void)celem; // best effort
fclose(pf); fclose(pf);