From: antirez Date: Thu, 22 Sep 2011 13:15:26 +0000 (+0200) Subject: merge conflicts resolved X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/f9c6f39b2b0039cf29df6597d41c124048c825cd merge conflicts resolved --- f9c6f39b2b0039cf29df6597d41c124048c825cd diff --cc src/Makefile index 36bba34c,bce8b6e5..dac6deaf --- a/src/Makefile +++ b/src/Makefile @@@ -56,12 -47,7 +56,12 @@@ BINCOLOR="\033[37;1m MAKECOLOR="\033[32;1m" ENDCOLOR="\033[0m" -OBJ = adlist.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 dscache.o pubsub.o multi.o debug.o sort.o intset.o syncio.o diskstore.o cluster.o crc16.o endian.o rio.o +ifndef V +QUIET_CC = @printf ' %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR); +QUIET_LINK = @printf ' %b %b\n' $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR); +endif + - OBJ = adlist.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 endian.o slowlog.o scripting.o bio.o ++OBJ = adlist.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 endian.o slowlog.o scripting.o bio.o rio.o BENCHOBJ = ae.o anet.o redis-benchmark.o sds.o adlist.o zmalloc.o CLIOBJ = anet.o sds.o adlist.o redis-cli.o zmalloc.o release.o CHECKDUMPOBJ = redis-check-dump.o lzf_c.o lzf_d.o @@@ -122,53 -105,43 +122,54 @@@ redis-check-dump.o: redis-check-dump.c redis-cli.o: redis-cli.c fmacros.h version.h ../deps/hiredis/hiredis.h \ sds.h zmalloc.h ../deps/linenoise/linenoise.h help.h redis.o: redis.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h asciilogo.h + zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h slowlog.h \ + bio.h asciilogo.h release.o: release.c release.h replication.o: replication.c redis.h fmacros.h config.h ae.h sds.h dict.h \ - adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h + adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h +scripting.o: scripting.c redis.h fmacros.h config.h ae.h sds.h dict.h \ + adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h \ + sha1.h + rio.o: rio.c sds.h sds.o: sds.c sds.h zmalloc.h -sha1.o: sha1.c sha1.h +sha1.o: sha1.c sha1.h config.h +slowlog.o: slowlog.c redis.h fmacros.h config.h ae.h sds.h dict.h \ + adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h \ + slowlog.h sort.o: sort.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h pqsort.h + zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h pqsort.h syncio.o: syncio.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h + zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h t_hash.o: t_hash.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h + zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h t_list.o: t_list.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h + zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h t_set.o: t_set.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h + zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h t_string.o: t_string.c redis.h fmacros.h config.h ae.h sds.h dict.h \ - adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h + adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h t_zset.o: t_zset.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h -util.o: util.c util.h -cluster.o: redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \ - zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h -ziplist.o: ziplist.c zmalloc.h ziplist.h -zipmap.o: zipmap.c zmalloc.h -zmalloc.o: zmalloc.c config.h + zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h util.h +util.o: util.c fmacros.h util.h +ziplist.o: ziplist.c zmalloc.h util.h ziplist.h endian.h +zipmap.o: zipmap.c zmalloc.h endian.h +zmalloc.o: zmalloc.c config.h zmalloc.h + +.PHONY: dependencies dependencies: - @echo $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)hiredis$(ENDCOLOR) + @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)hiredis$(ENDCOLOR) @cd ../deps/hiredis && $(MAKE) static ARCH="$(ARCH)" - @echo $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR) + @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR) @cd ../deps/linenoise && $(MAKE) ARCH="$(ARCH)" + @echo $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)Lua ansi$(ENDCOLOR) + @cd ../deps/lua && $(MAKE) ARCH="$(ARCH)" ansi -redis-server: $(OBJ) - @$(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ) - @echo $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$(@)$(ENDCOLOR) +../deps/jemalloc/lib/libjemalloc.a: + cd ../deps/jemalloc && ./configure $(JEMALLOC_CFLAGS) --with-jemalloc-prefix=je_ --enable-cc-silence && $(MAKE) lib/libjemalloc.a + +redis-server: dependencies $(OBJ) + $(QUIET_LINK)$(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ) $(CCLINK) $(ALLOC_LINK) ../deps/lua/src/liblua.a redis-benchmark: dependencies $(BENCHOBJ) @cd ../deps/hiredis && $(MAKE) static diff --cc src/aof.c index 8d654281,aadf6448..b86357de --- a/src/aof.c +++ b/src/aof.c @@@ -1,6 -1,4 +1,7 @@@ #include "redis.h" +#include "bio.h" ++#include "rio.h" + #include #include #include diff --cc src/cluster.c index e608c420,1c0b1c23..c6fc44b1 --- a/src/cluster.c +++ b/src/cluster.c @@@ -1383,14 -1383,13 +1383,13 @@@ void clusterCommand(redisClient *c) /* RESTORE key ttl serialized-value */ void restoreCommand(redisClient *c) { - FILE *fp; - char buf[64]; - robj *o; - unsigned char *data; long ttl; + rio payload; + int type; + robj *obj; /* Make sure this key does not already exist here... */ - if (dbExists(c->db,c->argv[1])) { + if (lookupKeyWrite(c->db,c->argv[1]) != NULL) { addReplyError(c,"Target key name is busy."); return; } diff --cc src/rdb.c index cfbec3e8,6d99375b..9bf470aa --- a/src/rdb.c +++ b/src/rdb.c @@@ -411,8 -586,14 +586,9 @@@ int rdbSave(char *filename) char tmpfile[256]; int j; time_t now = time(NULL); + FILE *fp; + rio rdb; - if (server.ds_enabled) { - cacheForcePointInTime(); - return dsRdbSave(filename); - } - snprintf(tmpfile,256,"temp-%d.rdb", (int) getpid()); fp = fopen(tmpfile,"w"); if (!fp) { @@@ -905,9 -945,8 +937,8 @@@ void stopLoading(void) } int rdbLoad(char *filename) { - FILE *fp; uint32_t dbid; - int type, retval, rdbver; + int type, rdbver; redisDb *db = server.db+0; char buf[1024]; time_t expiretime, now = time(NULL); diff --cc src/redis.h index e754918d,5af2da8e..e9a31b8c --- a/src/redis.h +++ b/src/redis.h @@@ -854,24 -855,10 +843,10 @@@ void loadingProgress(off_t pos) void stopLoading(void); /* RDB persistence */ - int rdbLoad(char *filename); - int rdbSaveBackground(char *filename); - void rdbRemoveTempFile(pid_t childpid); - int rdbSave(char *filename); - int rdbSaveObject(FILE *fp, robj *o); - off_t rdbSavedObjectLen(robj *o); - off_t rdbSavedObjectPages(robj *o); - robj *rdbLoadObject(int type, FILE *fp); - void backgroundSaveDoneHandler(int exitcode, int bysignal); - int rdbSaveKeyValuePair(FILE *fp, robj *key, robj *val, time_t expireitme, time_t now); - int rdbLoadType(FILE *fp); - time_t rdbLoadTime(FILE *fp); - robj *rdbLoadStringObject(FILE *fp); - int rdbSaveType(FILE *fp, unsigned char type); - int rdbSaveLen(FILE *fp, uint32_t len); + #include "rdb.h" /* AOF persistence */ -void flushAppendOnlyFile(void); +void flushAppendOnlyFile(int force); void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int argc); void aofRemoveTempFile(pid_t childpid); int rewriteAppendOnlyFileBackground(void);