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,20 +3320,26 @@ static void shutdownCommand(redisClient *c) { ...@@ -3320,20 +3320,26 @@ static void shutdownCommand(redisClient *c) {
kill(server.bgsavechildpid,SIGKILL); kill(server.bgsavechildpid,SIGKILL);
rdbRemoveTempFile(server.bgsavechildpid); rdbRemoveTempFile(server.bgsavechildpid);
} }
/* SYNC SAVE */ if (server.appendonly) {
if (rdbSave(server.dbfilename) == REDIS_OK) { /* Append only file: fsync() the AOF and exit */
if (server.daemonize) fsync(server.appendfd);
unlink(server.pidfile); exit(0);
redisLog(REDIS_WARNING,"%zu bytes used at exit",zmalloc_used_memory());
redisLog(REDIS_WARNING,"Server exit now, bye bye...");
exit(1);
} else { } else {
/* Ooops.. error saving! The best we can do is to continue operating. /* Snapshotting. Perform a SYNC SAVE and exit */
* Note that if there was a background saving process, in the next if (rdbSave(server.dbfilename) == REDIS_OK) {
* cron() Redis will be notified that the background saving aborted, if (server.daemonize)
* handling special stuff like slaves pending for synchronization... */ unlink(server.pidfile);
redisLog(REDIS_WARNING,"Error trying to save the DB, can't exit"); redisLog(REDIS_WARNING,"%zu bytes used at exit",zmalloc_used_memory());
addReplySds(c,sdsnew("-ERR can't quit, problems saving the DB\r\n")); redisLog(REDIS_WARNING,"Server exit now, bye bye...");
exit(0);
} else {
/* Ooops.. error saving! The best we can do is to continue operating.
* Note that if there was a background saving process, in the next
* cron() Redis will be notified that the background saving aborted,
* handling special stuff like slaves pending for synchronization... */
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"));
}
} }
} }
......
...@@ -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