From cef054e86856463d3e79d4a5048507377c85eab7 Mon Sep 17 00:00:00 2001 From: antirez Date: Sun, 26 Jul 2015 15:14:57 +0200 Subject: [PATCH] RDMF (Redis/Disque merge friendlyness) refactoring WIP 1. --- src/Makefile | 2 +- src/Makefile.dep | 62 ++++++++++++++++---------------- src/aof.c | 2 +- src/bio.c | 2 +- src/bitops.c | 2 +- src/blocked.c | 2 +- src/cluster.c | 2 +- src/config.c | 74 +++++++++++++++++++------------------- src/crc16.c | 2 +- src/db.c | 2 +- src/debug.c | 2 +- src/geo.h | 2 +- src/hyperloglog.c | 2 +- src/latency.c | 2 +- src/multi.c | 2 +- src/networking.c | 2 +- src/notify.c | 2 +- src/object.c | 2 +- src/pubsub.c | 2 +- src/rdb.c | 2 +- src/rdb.h | 2 +- src/redis-check-rdb.c | 2 +- src/replication.c | 2 +- src/rio.c | 2 +- src/scripting.c | 2 +- src/sentinel.c | 6 ++-- src/{redis.c => server.c} | 76 +++++++++++++++++++-------------------- src/{redis.h => server.h} | 74 +++++++++++++++++++------------------- src/slowlog.c | 2 +- src/sort.c | 2 +- src/sparkline.c | 2 +- src/syncio.c | 2 +- src/t_hash.c | 2 +- src/t_list.c | 2 +- src/t_set.c | 2 +- src/t_string.c | 2 +- src/t_zset.c | 2 +- 37 files changed, 178 insertions(+), 178 deletions(-) rename src/{redis.c => server.c} (98%) rename src/{redis.h => server.h} (97%) diff --git a/src/Makefile b/src/Makefile index 449b4ec26..648127a25 100644 --- a/src/Makefile +++ b/src/Makefile @@ -117,7 +117,7 @@ endif REDIS_SERVER_NAME=redis-server REDIS_SENTINEL_NAME=redis-sentinel -REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o geo.o +REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o geo.o REDIS_GEOHASH_OBJ=../deps/geohash-int/geohash.o ../deps/geohash-int/geohash_helper.o REDIS_CLI_NAME=redis-cli REDIS_CLI_OBJ=anet.o adlist.o redis-cli.o zmalloc.o release.o anet.o ae.o crc64.o diff --git a/src/Makefile.dep b/src/Makefile.dep index 33e89137d..ff8acb794 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep @@ -5,72 +5,72 @@ ae_evport.o: ae_evport.c ae_kqueue.o: ae_kqueue.c ae_select.o: ae_select.c anet.o: anet.c fmacros.h anet.h -aof.o: aof.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +aof.o: aof.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ bio.h -bio.o: bio.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +bio.o: bio.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ bio.h -bitops.o: bitops.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +bitops.o: bitops.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -blocked.o: blocked.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +blocked.o: blocked.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -cluster.o: cluster.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +cluster.o: cluster.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ cluster.h endianconv.h -config.o: config.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +config.o: config.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ cluster.h -crc16.o: crc16.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +crc16.o: crc16.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h crc64.o: crc64.c -db.o: db.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +db.o: db.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ cluster.h -debug.o: debug.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +debug.o: debug.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ sha1.h crc64.h bio.h dict.o: dict.c fmacros.h dict.h zmalloc.h redisassert.h endianconv.o: endianconv.c -hyperloglog.o: hyperloglog.c redis.h fmacros.h config.h \ +hyperloglog.o: hyperloglog.c server.h fmacros.h config.h \ ../deps/lua/src/lua.h ../deps/lua/src/luaconf.h ae.h sds.h dict.h \ adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h latency.h \ sparkline.h rdb.h rio.h intset.o: intset.c intset.h zmalloc.h endianconv.h config.h -latency.o: latency.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +latency.o: latency.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h lzf_c.o: lzf_c.c lzfP.h lzf_d.o: lzf_d.c lzfP.h memtest.o: memtest.c config.h -multi.o: multi.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +multi.o: multi.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -networking.o: networking.c redis.h fmacros.h config.h \ +networking.o: networking.c server.h fmacros.h config.h \ ../deps/lua/src/lua.h ../deps/lua/src/luaconf.h ae.h sds.h dict.h \ adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h latency.h \ sparkline.h rdb.h rio.h -notify.o: notify.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +notify.o: notify.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -object.o: object.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +object.o: object.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h pqsort.o: pqsort.c -pubsub.o: pubsub.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +pubsub.o: pubsub.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h rand.o: rand.c -rdb.o: rdb.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +rdb.o: rdb.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ lzf.h zipmap.h endianconv.h @@ -80,59 +80,59 @@ redis-check-aof.o: redis-check-aof.c fmacros.h config.h redis-check-dump.o: redis-check-dump.c lzf.h crc64.h redis-cli.o: redis-cli.c fmacros.h version.h ../deps/hiredis/hiredis.h \ sds.h zmalloc.h ../deps/linenoise/linenoise.h help.h anet.h ae.h -redis.o: redis.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +redis.o: redis.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ cluster.h slowlog.h bio.h asciilogo.h release.o: release.c release.h version.h crc64.h -replication.o: replication.c redis.h fmacros.h config.h \ +replication.o: replication.c server.h fmacros.h config.h \ ../deps/lua/src/lua.h ../deps/lua/src/luaconf.h ae.h sds.h dict.h \ adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h latency.h \ sparkline.h rdb.h rio.h -rio.o: rio.c fmacros.h rio.h sds.h util.h crc64.h config.h redis.h \ +rio.o: rio.c fmacros.h rio.h sds.h util.h crc64.h config.h server.h \ ../deps/lua/src/lua.h ../deps/lua/src/luaconf.h ae.h dict.h adlist.h \ zmalloc.h anet.h ziplist.h intset.h version.h latency.h sparkline.h \ rdb.h -scripting.o: scripting.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +scripting.o: scripting.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ sha1.h rand.h ../deps/lua/src/lauxlib.h ../deps/lua/src/lua.h \ ../deps/lua/src/lualib.h sds.o: sds.c sds.h zmalloc.h -sentinel.o: sentinel.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +sentinel.o: sentinel.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ ../deps/hiredis/hiredis.h ../deps/hiredis/async.h \ ../deps/hiredis/hiredis.h setproctitle.o: setproctitle.c sha1.o: sha1.c sha1.h config.h -slowlog.o: slowlog.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +slowlog.o: slowlog.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ slowlog.h -sort.o: sort.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +sort.o: sort.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h \ pqsort.h -sparkline.o: sparkline.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +sparkline.o: sparkline.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -syncio.o: syncio.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +syncio.o: syncio.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -t_hash.o: t_hash.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +t_hash.o: t_hash.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -t_list.o: t_list.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +t_list.o: t_list.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -t_set.o: t_set.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +t_set.o: t_set.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -t_string.o: t_string.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +t_string.o: t_string.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h -t_zset.o: t_zset.c redis.h fmacros.h config.h ../deps/lua/src/lua.h \ +t_zset.o: t_zset.c server.h fmacros.h config.h ../deps/lua/src/lua.h \ ../deps/lua/src/luaconf.h ae.h sds.h dict.h adlist.h zmalloc.h anet.h \ ziplist.h intset.h version.h util.h latency.h sparkline.h rdb.h rio.h util.o: util.c fmacros.h util.h sds.h diff --git a/src/aof.c b/src/aof.c index 01f0ce320..4a6ad6d5d 100644 --- a/src/aof.c +++ b/src/aof.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "bio.h" #include "rio.h" diff --git a/src/bio.c b/src/bio.c index 27bc9abfc..a9bccff18 100644 --- a/src/bio.c +++ b/src/bio.c @@ -58,7 +58,7 @@ */ -#include "redis.h" +#include "server.h" #include "bio.h" static pthread_t bio_threads[REDIS_BIO_NUM_OPS]; diff --git a/src/bitops.c b/src/bitops.c index ec912bc24..6763bf1b0 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /* ----------------------------------------------------------------------------- * Helpers and low level bit functions. diff --git a/src/blocked.c b/src/blocked.c index 2ec2cf626..95b68fba1 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -63,7 +63,7 @@ * clusterRedirectBlockedClientIfNeeded() function should also be updated. */ -#include "redis.h" +#include "server.h" /* Get a timeout value from an object and store it into 'timeout'. * The final timeout is always stored as milliseconds as a time where the diff --git a/src/cluster.c b/src/cluster.c index 6280677ae..f7f3da8a3 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "cluster.h" #include "endianconv.h" diff --git a/src/config.c b/src/config.c index fd56269ef..a6ea1ce7d 100644 --- a/src/config.c +++ b/src/config.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "cluster.h" #include @@ -1750,60 +1750,60 @@ int rewriteConfig(char *path) { * the rewrite state. */ rewriteConfigYesNoOption(state,"daemonize",server.daemonize,0); - rewriteConfigStringOption(state,"pidfile",server.pidfile,REDIS_DEFAULT_PID_FILE); + rewriteConfigStringOption(state,"pidfile",server.pidfile,CONFIG_DEFAULT_PID_FILE); rewriteConfigNumericalOption(state,"port",server.port,REDIS_SERVERPORT); rewriteConfigNumericalOption(state,"tcp-backlog",server.tcp_backlog,REDIS_TCP_BACKLOG); rewriteConfigBindOption(state); rewriteConfigStringOption(state,"unixsocket",server.unixsocket,NULL); - rewriteConfigOctalOption(state,"unixsocketperm",server.unixsocketperm,REDIS_DEFAULT_UNIX_SOCKET_PERM); + rewriteConfigOctalOption(state,"unixsocketperm",server.unixsocketperm,CONFIG_DEFAULT_UNIX_SOCKET_PERM); rewriteConfigNumericalOption(state,"timeout",server.maxidletime,REDIS_MAXIDLETIME); - rewriteConfigNumericalOption(state,"tcp-keepalive",server.tcpkeepalive,REDIS_DEFAULT_TCP_KEEPALIVE); - rewriteConfigEnumOption(state,"loglevel",server.verbosity,loglevel_enum,REDIS_DEFAULT_VERBOSITY); - rewriteConfigStringOption(state,"logfile",server.logfile,REDIS_DEFAULT_LOGFILE); - rewriteConfigYesNoOption(state,"syslog-enabled",server.syslog_enabled,REDIS_DEFAULT_SYSLOG_ENABLED); - rewriteConfigStringOption(state,"syslog-ident",server.syslog_ident,REDIS_DEFAULT_SYSLOG_IDENT); + rewriteConfigNumericalOption(state,"tcp-keepalive",server.tcpkeepalive,CONFIG_DEFAULT_TCP_KEEPALIVE); + rewriteConfigEnumOption(state,"loglevel",server.verbosity,loglevel_enum,CONFIG_DEFAULT_VERBOSITY); + rewriteConfigStringOption(state,"logfile",server.logfile,CONFIG_DEFAULT_LOGFILE); + rewriteConfigYesNoOption(state,"syslog-enabled",server.syslog_enabled,CONFIG_DEFAULT_SYSLOG_ENABLED); + rewriteConfigStringOption(state,"syslog-ident",server.syslog_ident,CONFIG_DEFAULT_SYSLOG_IDENT); rewriteConfigSyslogfacilityOption(state); rewriteConfigSaveOption(state); - rewriteConfigNumericalOption(state,"databases",server.dbnum,REDIS_DEFAULT_DBNUM); - rewriteConfigYesNoOption(state,"stop-writes-on-bgsave-error",server.stop_writes_on_bgsave_err,REDIS_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR); - rewriteConfigYesNoOption(state,"rdbcompression",server.rdb_compression,REDIS_DEFAULT_RDB_COMPRESSION); - rewriteConfigYesNoOption(state,"rdbchecksum",server.rdb_checksum,REDIS_DEFAULT_RDB_CHECKSUM); - rewriteConfigStringOption(state,"dbfilename",server.rdb_filename,REDIS_DEFAULT_RDB_FILENAME); + rewriteConfigNumericalOption(state,"databases",server.dbnum,CONFIG_DEFAULT_DBNUM); + rewriteConfigYesNoOption(state,"stop-writes-on-bgsave-error",server.stop_writes_on_bgsave_err,CONFIG_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR); + rewriteConfigYesNoOption(state,"rdbcompression",server.rdb_compression,CONFIG_DEFAULT_RDB_COMPRESSION); + rewriteConfigYesNoOption(state,"rdbchecksum",server.rdb_checksum,CONFIG_DEFAULT_RDB_CHECKSUM); + rewriteConfigStringOption(state,"dbfilename",server.rdb_filename,CONFIG_DEFAULT_RDB_FILENAME); rewriteConfigDirOption(state); rewriteConfigSlaveofOption(state); rewriteConfigStringOption(state,"masterauth",server.masterauth,NULL); - rewriteConfigYesNoOption(state,"slave-serve-stale-data",server.repl_serve_stale_data,REDIS_DEFAULT_SLAVE_SERVE_STALE_DATA); - rewriteConfigYesNoOption(state,"slave-read-only",server.repl_slave_ro,REDIS_DEFAULT_SLAVE_READ_ONLY); + rewriteConfigYesNoOption(state,"slave-serve-stale-data",server.repl_serve_stale_data,CONFIG_DEFAULT_SLAVE_SERVE_STALE_DATA); + rewriteConfigYesNoOption(state,"slave-read-only",server.repl_slave_ro,CONFIG_DEFAULT_SLAVE_READ_ONLY); rewriteConfigNumericalOption(state,"repl-ping-slave-period",server.repl_ping_slave_period,REDIS_REPL_PING_SLAVE_PERIOD); rewriteConfigNumericalOption(state,"repl-timeout",server.repl_timeout,REDIS_REPL_TIMEOUT); - rewriteConfigBytesOption(state,"repl-backlog-size",server.repl_backlog_size,REDIS_DEFAULT_REPL_BACKLOG_SIZE); - rewriteConfigBytesOption(state,"repl-backlog-ttl",server.repl_backlog_time_limit,REDIS_DEFAULT_REPL_BACKLOG_TIME_LIMIT); - rewriteConfigYesNoOption(state,"repl-disable-tcp-nodelay",server.repl_disable_tcp_nodelay,REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY); - rewriteConfigYesNoOption(state,"repl-diskless-sync",server.repl_diskless_sync,REDIS_DEFAULT_REPL_DISKLESS_SYNC); - rewriteConfigNumericalOption(state,"repl-diskless-sync-delay",server.repl_diskless_sync_delay,REDIS_DEFAULT_REPL_DISKLESS_SYNC_DELAY); - rewriteConfigNumericalOption(state,"slave-priority",server.slave_priority,REDIS_DEFAULT_SLAVE_PRIORITY); - rewriteConfigNumericalOption(state,"min-slaves-to-write",server.repl_min_slaves_to_write,REDIS_DEFAULT_MIN_SLAVES_TO_WRITE); - rewriteConfigNumericalOption(state,"min-slaves-max-lag",server.repl_min_slaves_max_lag,REDIS_DEFAULT_MIN_SLAVES_MAX_LAG); + rewriteConfigBytesOption(state,"repl-backlog-size",server.repl_backlog_size,CONFIG_DEFAULT_REPL_BACKLOG_SIZE); + rewriteConfigBytesOption(state,"repl-backlog-ttl",server.repl_backlog_time_limit,CONFIG_DEFAULT_REPL_BACKLOG_TIME_LIMIT); + rewriteConfigYesNoOption(state,"repl-disable-tcp-nodelay",server.repl_disable_tcp_nodelay,CONFIG_DEFAULT_REPL_DISABLE_TCP_NODELAY); + rewriteConfigYesNoOption(state,"repl-diskless-sync",server.repl_diskless_sync,CONFIG_DEFAULT_REPL_DISKLESS_SYNC); + rewriteConfigNumericalOption(state,"repl-diskless-sync-delay",server.repl_diskless_sync_delay,CONFIG_DEFAULT_REPL_DISKLESS_SYNC_DELAY); + rewriteConfigNumericalOption(state,"slave-priority",server.slave_priority,CONFIG_DEFAULT_SLAVE_PRIORITY); + rewriteConfigNumericalOption(state,"min-slaves-to-write",server.repl_min_slaves_to_write,CONFIG_DEFAULT_MIN_SLAVES_TO_WRITE); + rewriteConfigNumericalOption(state,"min-slaves-max-lag",server.repl_min_slaves_max_lag,CONFIG_DEFAULT_MIN_SLAVES_MAX_LAG); rewriteConfigStringOption(state,"requirepass",server.requirepass,NULL); - rewriteConfigNumericalOption(state,"maxclients",server.maxclients,REDIS_MAX_CLIENTS); - rewriteConfigBytesOption(state,"maxmemory",server.maxmemory,REDIS_DEFAULT_MAXMEMORY); - rewriteConfigEnumOption(state,"maxmemory-policy",server.maxmemory_policy,maxmemory_policy_enum,REDIS_DEFAULT_MAXMEMORY_POLICY); - rewriteConfigNumericalOption(state,"maxmemory-samples",server.maxmemory_samples,REDIS_DEFAULT_MAXMEMORY_SAMPLES); + rewriteConfigNumericalOption(state,"maxclients",server.maxclients,CONFIG_DEFAULT_MAX_CLIENTS); + rewriteConfigBytesOption(state,"maxmemory",server.maxmemory,CONFIG_DEFAULT_MAXMEMORY); + rewriteConfigEnumOption(state,"maxmemory-policy",server.maxmemory_policy,maxmemory_policy_enum,CONFIG_DEFAULT_MAXMEMORY_POLICY); + rewriteConfigNumericalOption(state,"maxmemory-samples",server.maxmemory_samples,CONFIG_DEFAULT_MAXMEMORY_SAMPLES); rewriteConfigYesNoOption(state,"appendonly",server.aof_state != REDIS_AOF_OFF,0); - rewriteConfigStringOption(state,"appendfilename",server.aof_filename,REDIS_DEFAULT_AOF_FILENAME); - rewriteConfigEnumOption(state,"appendfsync",server.aof_fsync,aof_fsync_enum,REDIS_DEFAULT_AOF_FSYNC); - rewriteConfigYesNoOption(state,"no-appendfsync-on-rewrite",server.aof_no_fsync_on_rewrite,REDIS_DEFAULT_AOF_NO_FSYNC_ON_REWRITE); + rewriteConfigStringOption(state,"appendfilename",server.aof_filename,CONFIG_DEFAULT_AOF_FILENAME); + rewriteConfigEnumOption(state,"appendfsync",server.aof_fsync,aof_fsync_enum,CONFIG_DEFAULT_AOF_FSYNC); + rewriteConfigYesNoOption(state,"no-appendfsync-on-rewrite",server.aof_no_fsync_on_rewrite,CONFIG_DEFAULT_AOF_NO_FSYNC_ON_REWRITE); rewriteConfigNumericalOption(state,"auto-aof-rewrite-percentage",server.aof_rewrite_perc,REDIS_AOF_REWRITE_PERC); rewriteConfigBytesOption(state,"auto-aof-rewrite-min-size",server.aof_rewrite_min_size,REDIS_AOF_REWRITE_MIN_SIZE); rewriteConfigNumericalOption(state,"lua-time-limit",server.lua_time_limit,REDIS_LUA_TIME_LIMIT); rewriteConfigYesNoOption(state,"cluster-enabled",server.cluster_enabled,0); - rewriteConfigStringOption(state,"cluster-config-file",server.cluster_configfile,REDIS_DEFAULT_CLUSTER_CONFIG_FILE); + rewriteConfigStringOption(state,"cluster-config-file",server.cluster_configfile,CONFIG_DEFAULT_CLUSTER_CONFIG_FILE); rewriteConfigYesNoOption(state,"cluster-require-full-coverage",server.cluster_require_full_coverage,REDIS_CLUSTER_DEFAULT_REQUIRE_FULL_COVERAGE); rewriteConfigNumericalOption(state,"cluster-node-timeout",server.cluster_node_timeout,REDIS_CLUSTER_DEFAULT_NODE_TIMEOUT); rewriteConfigNumericalOption(state,"cluster-migration-barrier",server.cluster_migration_barrier,REDIS_CLUSTER_DEFAULT_MIGRATION_BARRIER); rewriteConfigNumericalOption(state,"cluster-slave-validity-factor",server.cluster_slave_validity_factor,REDIS_CLUSTER_DEFAULT_SLAVE_VALIDITY); rewriteConfigNumericalOption(state,"slowlog-log-slower-than",server.slowlog_log_slower_than,REDIS_SLOWLOG_LOG_SLOWER_THAN); - rewriteConfigNumericalOption(state,"latency-monitor-threshold",server.latency_monitor_threshold,REDIS_DEFAULT_LATENCY_MONITOR_THRESHOLD); + rewriteConfigNumericalOption(state,"latency-monitor-threshold",server.latency_monitor_threshold,CONFIG_DEFAULT_LATENCY_MONITOR_THRESHOLD); rewriteConfigNumericalOption(state,"slowlog-max-len",server.slowlog_max_len,REDIS_SLOWLOG_MAX_LEN); rewriteConfigNotifykeyspaceeventsOption(state); rewriteConfigNumericalOption(state,"hash-max-ziplist-entries",server.hash_max_ziplist_entries,REDIS_HASH_MAX_ZIPLIST_ENTRIES); @@ -1813,12 +1813,12 @@ int rewriteConfig(char *path) { rewriteConfigNumericalOption(state,"set-max-intset-entries",server.set_max_intset_entries,REDIS_SET_MAX_INTSET_ENTRIES); rewriteConfigNumericalOption(state,"zset-max-ziplist-entries",server.zset_max_ziplist_entries,REDIS_ZSET_MAX_ZIPLIST_ENTRIES); rewriteConfigNumericalOption(state,"zset-max-ziplist-value",server.zset_max_ziplist_value,REDIS_ZSET_MAX_ZIPLIST_VALUE); - rewriteConfigNumericalOption(state,"hll-sparse-max-bytes",server.hll_sparse_max_bytes,REDIS_DEFAULT_HLL_SPARSE_MAX_BYTES); - rewriteConfigYesNoOption(state,"activerehashing",server.activerehashing,REDIS_DEFAULT_ACTIVE_REHASHING); + rewriteConfigNumericalOption(state,"hll-sparse-max-bytes",server.hll_sparse_max_bytes,CONFIG_DEFAULT_HLL_SPARSE_MAX_BYTES); + rewriteConfigYesNoOption(state,"activerehashing",server.activerehashing,CONFIG_DEFAULT_ACTIVE_REHASHING); rewriteConfigClientoutputbufferlimitOption(state); - rewriteConfigNumericalOption(state,"hz",server.hz,REDIS_DEFAULT_HZ); - rewriteConfigYesNoOption(state,"aof-rewrite-incremental-fsync",server.aof_rewrite_incremental_fsync,REDIS_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC); - rewriteConfigYesNoOption(state,"aof-load-truncated",server.aof_load_truncated,REDIS_DEFAULT_AOF_LOAD_TRUNCATED); + rewriteConfigNumericalOption(state,"hz",server.hz,CONFIG_DEFAULT_HZ); + rewriteConfigYesNoOption(state,"aof-rewrite-incremental-fsync",server.aof_rewrite_incremental_fsync,CONFIG_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC); + rewriteConfigYesNoOption(state,"aof-load-truncated",server.aof_load_truncated,CONFIG_DEFAULT_AOF_LOAD_TRUNCATED); rewriteConfigEnumOption(state,"supervised",server.supervised_mode,supervised_mode_enum,REDIS_SUPERVISED_NONE); /* Rewrite Sentinel config if in Sentinel mode. */ diff --git a/src/crc16.c b/src/crc16.c index 1ec9161c9..7b8c1dad0 100644 --- a/src/crc16.c +++ b/src/crc16.c @@ -1,4 +1,4 @@ -#include "redis.h" +#include "server.h" /* * Copyright 2001-2010 Georges Menie (www.menie.org) diff --git a/src/db.c b/src/db.c index 1493f0a20..35481fecd 100644 --- a/src/db.c +++ b/src/db.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "cluster.h" #include diff --git a/src/debug.c b/src/debug.c index 0d2f24245..fffefe6ad 100644 --- a/src/debug.c +++ b/src/debug.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "sha1.h" /* SHA1 is used for DEBUG DIGEST */ #include "crc64.h" diff --git a/src/geo.h b/src/geo.h index cf4e42c90..79d0a6a4a 100644 --- a/src/geo.h +++ b/src/geo.h @@ -1,7 +1,7 @@ #ifndef __GEO_H__ #define __GEO_H__ -#include "redis.h" +#include "server.h" /* Structures used inside geo.c in order to represent points and array of * points on the earth. */ diff --git a/src/hyperloglog.c b/src/hyperloglog.c index b3542f997..74e7b8fc6 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include #include diff --git a/src/latency.c b/src/latency.c index 54ed03778..d6261f603 100644 --- a/src/latency.c +++ b/src/latency.c @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /* Dictionary type for latency events. */ int dictStringKeyCompare(void *privdata, const void *key1, const void *key2) { diff --git a/src/multi.c b/src/multi.c index c82876456..313fccd04 100644 --- a/src/multi.c +++ b/src/multi.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /* ================================ MULTI/EXEC ============================== */ diff --git a/src/networking.c b/src/networking.c index fc3746fd9..0df37c0fa 100644 --- a/src/networking.c +++ b/src/networking.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include #include diff --git a/src/notify.c b/src/notify.c index f77239ecf..6c915e659 100644 --- a/src/notify.c +++ b/src/notify.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /* This file implements keyspace events notification via Pub/Sub ad * described at http://redis.io/topics/keyspace-events. */ diff --git a/src/object.c b/src/object.c index 881b1ac4b..e3f44b3d8 100644 --- a/src/object.c +++ b/src/object.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include #include diff --git a/src/pubsub.c b/src/pubsub.c index d6cfbdf3c..0711387c2 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /*----------------------------------------------------------------------------- * Pubsub low level API diff --git a/src/rdb.c b/src/rdb.c index e4da23ba1..bbc791046 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "lzf.h" /* LZF compression library */ #include "zipmap.h" #include "endianconv.h" diff --git a/src/rdb.h b/src/rdb.h index a72607b71..da0d50e83 100644 --- a/src/rdb.h +++ b/src/rdb.h @@ -34,7 +34,7 @@ #include "rio.h" /* TBD: include only necessary headers. */ -#include "redis.h" +#include "server.h" /* The current RDB version. When the format changes in a way that is no longer * backward compatible this number gets incremented. */ diff --git a/src/redis-check-rdb.c b/src/redis-check-rdb.c index 21f72c222..da73bd38b 100644 --- a/src/redis-check-rdb.c +++ b/src/redis-check-rdb.c @@ -29,7 +29,7 @@ */ -#include "redis.h" +#include "server.h" #include "rdb.h" #include #include diff --git a/src/replication.c b/src/replication.c index c0145b4a1..0d35ccd3d 100644 --- a/src/replication.c +++ b/src/replication.c @@ -29,7 +29,7 @@ */ -#include "redis.h" +#include "server.h" #include #include diff --git a/src/rio.c b/src/rio.c index 738e56fd0..1cc6225f7 100644 --- a/src/rio.c +++ b/src/rio.c @@ -53,7 +53,7 @@ #include "util.h" #include "crc64.h" #include "config.h" -#include "redis.h" +#include "server.h" /* ------------------------- Buffer I/O implementation ----------------------- */ diff --git a/src/scripting.c b/src/scripting.c index 228770bfa..6c1963793 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "sha1.h" #include "rand.h" #include "cluster.h" diff --git a/src/sentinel.c b/src/sentinel.c index 3ff8899d7..5fa8258cd 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "hiredis.h" #include "async.h" @@ -1840,7 +1840,7 @@ void sentinelFlushConfig(void) { int saved_hz = server.hz; int rewrite_status; - server.hz = REDIS_DEFAULT_HZ; + server.hz = CONFIG_DEFAULT_HZ; rewrite_status = rewriteConfig(server.configfile); server.hz = saved_hz; @@ -4288,6 +4288,6 @@ void sentinelTimer(void) { * exactly continue to stay synchronized asking to be voted at the * same time again and again (resulting in nobody likely winning the * election because of split brain voting). */ - server.hz = REDIS_DEFAULT_HZ + rand() % REDIS_DEFAULT_HZ; + server.hz = CONFIG_DEFAULT_HZ + rand() % CONFIG_DEFAULT_HZ; } diff --git a/src/redis.c b/src/server.c similarity index 98% rename from src/redis.c rename to src/server.c index b5ade925e..3459a0119 100644 --- a/src/redis.c +++ b/src/server.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include "cluster.h" #include "slowlog.h" #include "bio.h" @@ -1416,34 +1416,34 @@ void initServerConfig(void) { getRandomHexChars(server.runid,REDIS_RUN_ID_SIZE); server.configfile = NULL; - server.hz = REDIS_DEFAULT_HZ; + server.hz = CONFIG_DEFAULT_HZ; server.runid[REDIS_RUN_ID_SIZE] = '\0'; server.arch_bits = (sizeof(long) == 8) ? 64 : 32; server.port = REDIS_SERVERPORT; server.tcp_backlog = REDIS_TCP_BACKLOG; server.bindaddr_count = 0; server.unixsocket = NULL; - server.unixsocketperm = REDIS_DEFAULT_UNIX_SOCKET_PERM; + server.unixsocketperm = CONFIG_DEFAULT_UNIX_SOCKET_PERM; server.ipfd_count = 0; server.sofd = -1; - server.dbnum = REDIS_DEFAULT_DBNUM; - server.verbosity = REDIS_DEFAULT_VERBOSITY; + server.dbnum = CONFIG_DEFAULT_DBNUM; + server.verbosity = CONFIG_DEFAULT_VERBOSITY; server.maxidletime = REDIS_MAXIDLETIME; - server.tcpkeepalive = REDIS_DEFAULT_TCP_KEEPALIVE; + server.tcpkeepalive = CONFIG_DEFAULT_TCP_KEEPALIVE; server.active_expire_enabled = 1; server.client_max_querybuf_len = REDIS_MAX_QUERYBUF_LEN; server.saveparams = NULL; server.loading = 0; - server.logfile = zstrdup(REDIS_DEFAULT_LOGFILE); - server.syslog_enabled = REDIS_DEFAULT_SYSLOG_ENABLED; - server.syslog_ident = zstrdup(REDIS_DEFAULT_SYSLOG_IDENT); + server.logfile = zstrdup(CONFIG_DEFAULT_LOGFILE); + server.syslog_enabled = CONFIG_DEFAULT_SYSLOG_ENABLED; + server.syslog_ident = zstrdup(CONFIG_DEFAULT_SYSLOG_IDENT); server.syslog_facility = LOG_LOCAL0; - server.daemonize = REDIS_DEFAULT_DAEMONIZE; + server.daemonize = CONFIG_DEFAULT_DAEMONIZE; server.supervised = 0; server.supervised_mode = REDIS_SUPERVISED_NONE; server.aof_state = REDIS_AOF_OFF; - server.aof_fsync = REDIS_DEFAULT_AOF_FSYNC; - server.aof_no_fsync_on_rewrite = REDIS_DEFAULT_AOF_NO_FSYNC_ON_REWRITE; + server.aof_fsync = CONFIG_DEFAULT_AOF_FSYNC; + server.aof_no_fsync_on_rewrite = CONFIG_DEFAULT_AOF_NO_FSYNC_ON_REWRITE; server.aof_rewrite_perc = REDIS_AOF_REWRITE_PERC; server.aof_rewrite_min_size = REDIS_AOF_REWRITE_MIN_SIZE; server.aof_rewrite_base_size = 0; @@ -1456,22 +1456,22 @@ void initServerConfig(void) { server.aof_fd = -1; server.aof_selected_db = -1; /* Make sure the first time will not match */ server.aof_flush_postponed_start = 0; - server.aof_rewrite_incremental_fsync = REDIS_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC; - server.aof_load_truncated = REDIS_DEFAULT_AOF_LOAD_TRUNCATED; + server.aof_rewrite_incremental_fsync = CONFIG_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC; + server.aof_load_truncated = CONFIG_DEFAULT_AOF_LOAD_TRUNCATED; server.pidfile = NULL; - server.rdb_filename = zstrdup(REDIS_DEFAULT_RDB_FILENAME); - server.aof_filename = zstrdup(REDIS_DEFAULT_AOF_FILENAME); + server.rdb_filename = zstrdup(CONFIG_DEFAULT_RDB_FILENAME); + server.aof_filename = zstrdup(CONFIG_DEFAULT_AOF_FILENAME); server.requirepass = NULL; - server.rdb_compression = REDIS_DEFAULT_RDB_COMPRESSION; - server.rdb_checksum = REDIS_DEFAULT_RDB_CHECKSUM; - server.stop_writes_on_bgsave_err = REDIS_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR; - server.activerehashing = REDIS_DEFAULT_ACTIVE_REHASHING; + server.rdb_compression = CONFIG_DEFAULT_RDB_COMPRESSION; + server.rdb_checksum = CONFIG_DEFAULT_RDB_CHECKSUM; + server.stop_writes_on_bgsave_err = CONFIG_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR; + server.activerehashing = CONFIG_DEFAULT_ACTIVE_REHASHING; server.notify_keyspace_events = 0; - server.maxclients = REDIS_MAX_CLIENTS; + server.maxclients = CONFIG_DEFAULT_MAX_CLIENTS; server.bpop_blocked_clients = 0; - server.maxmemory = REDIS_DEFAULT_MAXMEMORY; - server.maxmemory_policy = REDIS_DEFAULT_MAXMEMORY_POLICY; - server.maxmemory_samples = REDIS_DEFAULT_MAXMEMORY_SAMPLES; + server.maxmemory = CONFIG_DEFAULT_MAXMEMORY; + server.maxmemory_policy = CONFIG_DEFAULT_MAXMEMORY_POLICY; + server.maxmemory_samples = CONFIG_DEFAULT_MAXMEMORY_SAMPLES; server.hash_max_ziplist_entries = REDIS_HASH_MAX_ZIPLIST_ENTRIES; server.hash_max_ziplist_value = REDIS_HASH_MAX_ZIPLIST_VALUE; server.list_max_ziplist_size = REDIS_LIST_MAX_ZIPLIST_SIZE; @@ -1479,18 +1479,18 @@ void initServerConfig(void) { server.set_max_intset_entries = REDIS_SET_MAX_INTSET_ENTRIES; server.zset_max_ziplist_entries = REDIS_ZSET_MAX_ZIPLIST_ENTRIES; server.zset_max_ziplist_value = REDIS_ZSET_MAX_ZIPLIST_VALUE; - server.hll_sparse_max_bytes = REDIS_DEFAULT_HLL_SPARSE_MAX_BYTES; + server.hll_sparse_max_bytes = CONFIG_DEFAULT_HLL_SPARSE_MAX_BYTES; server.shutdown_asap = 0; server.repl_ping_slave_period = REDIS_REPL_PING_SLAVE_PERIOD; server.repl_timeout = REDIS_REPL_TIMEOUT; - server.repl_min_slaves_to_write = REDIS_DEFAULT_MIN_SLAVES_TO_WRITE; - server.repl_min_slaves_max_lag = REDIS_DEFAULT_MIN_SLAVES_MAX_LAG; + server.repl_min_slaves_to_write = CONFIG_DEFAULT_MIN_SLAVES_TO_WRITE; + server.repl_min_slaves_max_lag = CONFIG_DEFAULT_MIN_SLAVES_MAX_LAG; server.cluster_enabled = 0; server.cluster_node_timeout = REDIS_CLUSTER_DEFAULT_NODE_TIMEOUT; server.cluster_migration_barrier = REDIS_CLUSTER_DEFAULT_MIGRATION_BARRIER; server.cluster_slave_validity_factor = REDIS_CLUSTER_DEFAULT_SLAVE_VALIDITY; server.cluster_require_full_coverage = REDIS_CLUSTER_DEFAULT_REQUIRE_FULL_COVERAGE; - server.cluster_configfile = zstrdup(REDIS_DEFAULT_CLUSTER_CONFIG_FILE); + server.cluster_configfile = zstrdup(CONFIG_DEFAULT_CLUSTER_CONFIG_FILE); server.lua_caller = NULL; server.lua_time_limit = REDIS_LUA_TIME_LIMIT; server.lua_client = NULL; @@ -1514,22 +1514,22 @@ void initServerConfig(void) { server.repl_master_initial_offset = -1; server.repl_state = REDIS_REPL_NONE; server.repl_syncio_timeout = REDIS_REPL_SYNCIO_TIMEOUT; - server.repl_serve_stale_data = REDIS_DEFAULT_SLAVE_SERVE_STALE_DATA; - server.repl_slave_ro = REDIS_DEFAULT_SLAVE_READ_ONLY; + server.repl_serve_stale_data = CONFIG_DEFAULT_SLAVE_SERVE_STALE_DATA; + server.repl_slave_ro = CONFIG_DEFAULT_SLAVE_READ_ONLY; server.repl_down_since = 0; /* Never connected, repl is down since EVER. */ - server.repl_disable_tcp_nodelay = REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY; - server.repl_diskless_sync = REDIS_DEFAULT_REPL_DISKLESS_SYNC; - server.repl_diskless_sync_delay = REDIS_DEFAULT_REPL_DISKLESS_SYNC_DELAY; - server.slave_priority = REDIS_DEFAULT_SLAVE_PRIORITY; + server.repl_disable_tcp_nodelay = CONFIG_DEFAULT_REPL_DISABLE_TCP_NODELAY; + server.repl_diskless_sync = CONFIG_DEFAULT_REPL_DISKLESS_SYNC; + server.repl_diskless_sync_delay = CONFIG_DEFAULT_REPL_DISKLESS_SYNC_DELAY; + server.slave_priority = CONFIG_DEFAULT_SLAVE_PRIORITY; server.master_repl_offset = 0; /* Replication partial resync backlog */ server.repl_backlog = NULL; - server.repl_backlog_size = REDIS_DEFAULT_REPL_BACKLOG_SIZE; + server.repl_backlog_size = CONFIG_DEFAULT_REPL_BACKLOG_SIZE; server.repl_backlog_histlen = 0; server.repl_backlog_idx = 0; server.repl_backlog_off = 0; - server.repl_backlog_time_limit = REDIS_DEFAULT_REPL_BACKLOG_TIME_LIMIT; + server.repl_backlog_time_limit = CONFIG_DEFAULT_REPL_BACKLOG_TIME_LIMIT; server.repl_no_slaves_since = time(NULL); /* Client output buffer limits */ @@ -1560,7 +1560,7 @@ void initServerConfig(void) { server.slowlog_max_len = REDIS_SLOWLOG_MAX_LEN; /* Latency monitor */ - server.latency_monitor_threshold = REDIS_DEFAULT_LATENCY_MONITOR_THRESHOLD; + server.latency_monitor_threshold = CONFIG_DEFAULT_LATENCY_MONITOR_THRESHOLD; /* Debugging */ server.assert_failed = ""; @@ -3455,7 +3455,7 @@ void linuxMemoryWarnings(void) { void createPidFile(void) { /* If pidfile requested, but no pidfile defined, use * default pidfile path */ - if (!server.pidfile) server.pidfile = zstrdup(REDIS_DEFAULT_PID_FILE); + if (!server.pidfile) server.pidfile = zstrdup(CONFIG_DEFAULT_PID_FILE); /* Try to write the pid file in a best-effort way. */ FILE *fp = fopen(server.pidfile,"w"); diff --git a/src/redis.h b/src/server.h similarity index 97% rename from src/redis.h rename to src/server.h index b64a7697a..7149bb4f5 100644 --- a/src/redis.h +++ b/src/server.h @@ -75,13 +75,13 @@ typedef long long mstime_t; /* millisecond time type. */ #define REDIS_ERR -1 /* Static server configuration */ -#define REDIS_DEFAULT_HZ 10 /* Time interrupt calls/sec. */ +#define CONFIG_DEFAULT_HZ 10 /* Time interrupt calls/sec. */ #define REDIS_MIN_HZ 1 #define REDIS_MAX_HZ 500 #define REDIS_SERVERPORT 6379 /* TCP port */ #define REDIS_TCP_BACKLOG 511 /* TCP listen backlog */ #define REDIS_MAXIDLETIME 0 /* default client timeout: infinite */ -#define REDIS_DEFAULT_DBNUM 16 +#define CONFIG_DEFAULT_DBNUM 16 #define REDIS_CONFIGLINE_MAX 1024 #define REDIS_DBCRON_DBS_PER_CALL 16 #define REDIS_MAX_WRITE_PER_EVENT (1024*64) @@ -94,48 +94,48 @@ typedef long long mstime_t; /* millisecond time type. */ #define REDIS_AOF_REWRITE_ITEMS_PER_CMD 64 #define REDIS_SLOWLOG_LOG_SLOWER_THAN 10000 #define REDIS_SLOWLOG_MAX_LEN 128 -#define REDIS_MAX_CLIENTS 10000 +#define CONFIG_DEFAULT_MAX_CLIENTS 10000 #define REDIS_AUTHPASS_MAX_LEN 512 -#define REDIS_DEFAULT_SLAVE_PRIORITY 100 +#define CONFIG_DEFAULT_SLAVE_PRIORITY 100 #define REDIS_REPL_TIMEOUT 60 #define REDIS_REPL_PING_SLAVE_PERIOD 10 #define REDIS_RUN_ID_SIZE 40 #define REDIS_EOF_MARK_SIZE 40 -#define REDIS_DEFAULT_REPL_BACKLOG_SIZE (1024*1024) /* 1mb */ -#define REDIS_DEFAULT_REPL_BACKLOG_TIME_LIMIT (60*60) /* 1 hour */ +#define CONFIG_DEFAULT_REPL_BACKLOG_SIZE (1024*1024) /* 1mb */ +#define CONFIG_DEFAULT_REPL_BACKLOG_TIME_LIMIT (60*60) /* 1 hour */ #define REDIS_REPL_BACKLOG_MIN_SIZE (1024*16) /* 16k */ #define REDIS_BGSAVE_RETRY_DELAY 5 /* Wait a few secs before trying again. */ -#define REDIS_DEFAULT_PID_FILE "/var/run/redis.pid" -#define REDIS_DEFAULT_SYSLOG_IDENT "redis" -#define REDIS_DEFAULT_CLUSTER_CONFIG_FILE "nodes.conf" -#define REDIS_DEFAULT_DAEMONIZE 0 -#define REDIS_DEFAULT_UNIX_SOCKET_PERM 0 -#define REDIS_DEFAULT_TCP_KEEPALIVE 0 -#define REDIS_DEFAULT_LOGFILE "" -#define REDIS_DEFAULT_SYSLOG_ENABLED 0 -#define REDIS_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR 1 -#define REDIS_DEFAULT_RDB_COMPRESSION 1 -#define REDIS_DEFAULT_RDB_CHECKSUM 1 -#define REDIS_DEFAULT_RDB_FILENAME "dump.rdb" -#define REDIS_DEFAULT_REPL_DISKLESS_SYNC 0 -#define REDIS_DEFAULT_REPL_DISKLESS_SYNC_DELAY 5 -#define REDIS_DEFAULT_SLAVE_SERVE_STALE_DATA 1 -#define REDIS_DEFAULT_SLAVE_READ_ONLY 1 -#define REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY 0 -#define REDIS_DEFAULT_MAXMEMORY 0 -#define REDIS_DEFAULT_MAXMEMORY_SAMPLES 5 -#define REDIS_DEFAULT_AOF_FILENAME "appendonly.aof" -#define REDIS_DEFAULT_AOF_NO_FSYNC_ON_REWRITE 0 -#define REDIS_DEFAULT_AOF_LOAD_TRUNCATED 1 -#define REDIS_DEFAULT_ACTIVE_REHASHING 1 -#define REDIS_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC 1 -#define REDIS_DEFAULT_MIN_SLAVES_TO_WRITE 0 -#define REDIS_DEFAULT_MIN_SLAVES_MAX_LAG 10 +#define CONFIG_DEFAULT_PID_FILE "/var/run/redis.pid" +#define CONFIG_DEFAULT_SYSLOG_IDENT "redis" +#define CONFIG_DEFAULT_CLUSTER_CONFIG_FILE "nodes.conf" +#define CONFIG_DEFAULT_DAEMONIZE 0 +#define CONFIG_DEFAULT_UNIX_SOCKET_PERM 0 +#define CONFIG_DEFAULT_TCP_KEEPALIVE 0 +#define CONFIG_DEFAULT_LOGFILE "" +#define CONFIG_DEFAULT_SYSLOG_ENABLED 0 +#define CONFIG_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR 1 +#define CONFIG_DEFAULT_RDB_COMPRESSION 1 +#define CONFIG_DEFAULT_RDB_CHECKSUM 1 +#define CONFIG_DEFAULT_RDB_FILENAME "dump.rdb" +#define CONFIG_DEFAULT_REPL_DISKLESS_SYNC 0 +#define CONFIG_DEFAULT_REPL_DISKLESS_SYNC_DELAY 5 +#define CONFIG_DEFAULT_SLAVE_SERVE_STALE_DATA 1 +#define CONFIG_DEFAULT_SLAVE_READ_ONLY 1 +#define CONFIG_DEFAULT_REPL_DISABLE_TCP_NODELAY 0 +#define CONFIG_DEFAULT_MAXMEMORY 0 +#define CONFIG_DEFAULT_MAXMEMORY_SAMPLES 5 +#define CONFIG_DEFAULT_AOF_FILENAME "appendonly.aof" +#define CONFIG_DEFAULT_AOF_NO_FSYNC_ON_REWRITE 0 +#define CONFIG_DEFAULT_AOF_LOAD_TRUNCATED 1 +#define CONFIG_DEFAULT_ACTIVE_REHASHING 1 +#define CONFIG_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC 1 +#define CONFIG_DEFAULT_MIN_SLAVES_TO_WRITE 0 +#define CONFIG_DEFAULT_MIN_SLAVES_MAX_LAG 10 #define REDIS_IP_STR_LEN 46 /* INET6_ADDRSTRLEN is 46, but we need to be sure */ #define REDIS_PEER_ID_LEN (REDIS_IP_STR_LEN+32) /* Must be enough for ip:port */ #define REDIS_BINDADDR_MAX 16 #define REDIS_MIN_RESERVED_FDS 32 -#define REDIS_DEFAULT_LATENCY_MONITOR_THRESHOLD 0 +#define CONFIG_DEFAULT_LATENCY_MONITOR_THRESHOLD 0 #define ACTIVE_EXPIRE_CYCLE_LOOKUPS_PER_LOOP 20 /* Loopkups per loop. */ #define ACTIVE_EXPIRE_CYCLE_FAST_DURATION 1000 /* Microseconds */ @@ -312,7 +312,7 @@ typedef long long mstime_t; /* millisecond time type. */ #define REDIS_NOTICE 2 #define REDIS_WARNING 3 #define REDIS_LOG_RAW (1<<10) /* Modifier to log without timestamp */ -#define REDIS_DEFAULT_VERBOSITY REDIS_NOTICE +#define CONFIG_DEFAULT_VERBOSITY REDIS_NOTICE /* Supervision options */ #define REDIS_SUPERVISED_NONE 0 @@ -330,7 +330,7 @@ typedef long long mstime_t; /* millisecond time type. */ #define AOF_FSYNC_NO 0 #define AOF_FSYNC_ALWAYS 1 #define AOF_FSYNC_EVERYSEC 2 -#define REDIS_DEFAULT_AOF_FSYNC AOF_FSYNC_EVERYSEC +#define CONFIG_DEFAULT_AOF_FSYNC AOF_FSYNC_EVERYSEC /* Zip structure related defaults */ #define REDIS_HASH_MAX_ZIPLIST_ENTRIES 512 @@ -344,7 +344,7 @@ typedef long long mstime_t; /* millisecond time type. */ #define REDIS_LIST_COMPRESS_DEPTH 0 /* HyperLogLog defines */ -#define REDIS_DEFAULT_HLL_SPARSE_MAX_BYTES 3000 +#define CONFIG_DEFAULT_HLL_SPARSE_MAX_BYTES 3000 /* Sets operations codes */ #define REDIS_OP_UNION 0 @@ -358,7 +358,7 @@ typedef long long mstime_t; /* millisecond time type. */ #define REDIS_MAXMEMORY_ALLKEYS_LRU 3 #define REDIS_MAXMEMORY_ALLKEYS_RANDOM 4 #define REDIS_MAXMEMORY_NO_EVICTION 5 -#define REDIS_DEFAULT_MAXMEMORY_POLICY REDIS_MAXMEMORY_NO_EVICTION +#define CONFIG_DEFAULT_MAXMEMORY_POLICY REDIS_MAXMEMORY_NO_EVICTION /* Scripting */ #define REDIS_LUA_TIME_LIMIT 5000 /* milliseconds */ diff --git a/src/slowlog.c b/src/slowlog.c index ff6ccf472..a88967ae1 100644 --- a/src/slowlog.c +++ b/src/slowlog.c @@ -39,7 +39,7 @@ */ -#include "redis.h" +#include "server.h" #include "slowlog.h" /* Create a new slowlog entry. diff --git a/src/sort.c b/src/sort.c index 7da4de152..026f90002 100644 --- a/src/sort.c +++ b/src/sort.c @@ -29,7 +29,7 @@ */ -#include "redis.h" +#include "server.h" #include "pqsort.h" /* Partial qsort for SORT+LIMIT */ #include /* isnan() */ diff --git a/src/sparkline.c b/src/sparkline.c index 8e2764aee..0a986883d 100644 --- a/src/sparkline.c +++ b/src/sparkline.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include diff --git a/src/syncio.c b/src/syncio.c index ac2a4a373..f9504390b 100644 --- a/src/syncio.c +++ b/src/syncio.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /* ----------------- Blocking sockets I/O with timeouts --------------------- */ diff --git a/src/t_hash.c b/src/t_hash.c index 2f3487f6a..ddfcf31a8 100644 --- a/src/t_hash.c +++ b/src/t_hash.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include /*----------------------------------------------------------------------------- diff --git a/src/t_list.c b/src/t_list.c index 232cb5c52..93f5f7058 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /*----------------------------------------------------------------------------- * List API diff --git a/src/t_set.c b/src/t_set.c index e8ce783c0..746d0f19c 100644 --- a/src/t_set.c +++ b/src/t_set.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" /*----------------------------------------------------------------------------- * Set Commands diff --git a/src/t_string.c b/src/t_string.c index 06c2e9ceb..c0e86d4df 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "redis.h" +#include "server.h" #include /* isnan(), isinf() */ /*----------------------------------------------------------------------------- diff --git a/src/t_zset.c b/src/t_zset.c index 386258da1..3380832d9 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -49,7 +49,7 @@ * pointers being only at "level 1". This allows to traverse the list * from tail to head, useful for ZREVRANGE. */ -#include "redis.h" +#include "server.h" #include static int zslLexValueGteMin(robj *value, zlexrangespec *spec);