Commit ac945e2d authored by antirez's avatar antirez
Browse files

SHUTDOWN now does the right thing when append only is on, that is, fsync...

SHUTDOWN now does the right thing when append only is on, that is, fsync instead to save the snapshot.
parent fdcaae84
...@@ -75,7 +75,7 @@ it's not a guarantee they'll ever get implemented ;) ...@@ -75,7 +75,7 @@ it's not a guarantee they'll ever get implemented ;)
* Pattern-matching replication. * Pattern-matching replication.
* Don't save empty lists / sets / zsets on disk with snapshotting. * Don't save empty lists / sets / zsets on disk with snapshotting.
* Remove keys when a list / set / zset reaches length of 0. * Remove keys when a list / set / zset reaches length of 0.
* Add an option to relax the delete-expiring-keys-on-write semantic *denying* replication and AOF when this is on? Can be handy sometimes, when using Redis for non persistent state. * Add an option to relax the delete-expiring-keys-on-write semantic *denying* replication and AOF when this is on? Can be handy sometimes, when using Redis for non persistent state, but can create problems. For instance should rename and move also "move" the timeouts? How does this affect other commands?
DOCUMENTATION WISHLIST DOCUMENTATION WISHLIST
====================== ======================
......
...@@ -3320,13 +3320,18 @@ static void shutdownCommand(redisClient *c) { ...@@ -3320,13 +3320,18 @@ static void shutdownCommand(redisClient *c) {
kill(server.bgsavechildpid,SIGKILL); kill(server.bgsavechildpid,SIGKILL);
rdbRemoveTempFile(server.bgsavechildpid); rdbRemoveTempFile(server.bgsavechildpid);
} }
/* SYNC SAVE */ if (server.appendonly) {
/* Append only file: fsync() the AOF and exit */
fsync(server.appendfd);
exit(0);
} else {
/* Snapshotting. Perform a SYNC SAVE and exit */
if (rdbSave(server.dbfilename) == REDIS_OK) { if (rdbSave(server.dbfilename) == REDIS_OK) {
if (server.daemonize) if (server.daemonize)
unlink(server.pidfile); unlink(server.pidfile);
redisLog(REDIS_WARNING,"%zu bytes used at exit",zmalloc_used_memory()); redisLog(REDIS_WARNING,"%zu bytes used at exit",zmalloc_used_memory());
redisLog(REDIS_WARNING,"Server exit now, bye bye..."); redisLog(REDIS_WARNING,"Server exit now, bye bye...");
exit(1); exit(0);
} else { } else {
/* Ooops.. error saving! The best we can do is to continue operating. /* Ooops.. error saving! The best we can do is to continue operating.
* Note that if there was a background saving process, in the next * Note that if there was a background saving process, in the next
...@@ -3335,6 +3340,7 @@ static void shutdownCommand(redisClient *c) { ...@@ -3335,6 +3340,7 @@ static void shutdownCommand(redisClient *c) {
redisLog(REDIS_WARNING,"Error trying to save the DB, can't exit"); redisLog(REDIS_WARNING,"Error trying to save the DB, can't exit");
addReplySds(c,sdsnew("-ERR can't quit, problems saving the DB\r\n")); addReplySds(c,sdsnew("-ERR can't quit, problems saving the DB\r\n"));
} }
}
} }
static void renameGenericCommand(redisClient *c, int nx) { static void renameGenericCommand(redisClient *c, int nx) {
......
...@@ -1184,7 +1184,11 @@ proc main {server port} { ...@@ -1184,7 +1184,11 @@ proc main {server port} {
set _ $err set _ $err
} {} } {}
test {ZRANGE and ZREVRANGE} { test {ZRANGE and ZREVRANGE basics} {
list [$r zrange ztmp 0 -1] [$r zrevrange ztmp 0 -1]
} {{y x z} {z x y}}
test {ZRANGE and ZREVRANGE stress testing} {
list [$r zrange ztmp 0 -1] [$r zrevrange ztmp 0 -1] list [$r zrange ztmp 0 -1] [$r zrevrange ztmp 0 -1]
} {{y x z} {z x y}} } {{y x z} {z x y}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment