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 ;)
* Pattern-matching replication.
* Don't save empty lists / sets / zsets on disk with snapshotting.
* 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
======================
......
......@@ -3320,20 +3320,26 @@ static void shutdownCommand(redisClient *c) {
kill(server.bgsavechildpid,SIGKILL);
rdbRemoveTempFile(server.bgsavechildpid);
}
/* SYNC SAVE */
if (rdbSave(server.dbfilename) == REDIS_OK) {
if (server.daemonize)
unlink(server.pidfile);
redisLog(REDIS_WARNING,"%zu bytes used at exit",zmalloc_used_memory());
redisLog(REDIS_WARNING,"Server exit now, bye bye...");
exit(1);
if (server.appendonly) {
/* Append only file: fsync() the AOF and exit */
fsync(server.appendfd);
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"));
/* Snapshotting. Perform a SYNC SAVE and exit */
if (rdbSave(server.dbfilename) == REDIS_OK) {
if (server.daemonize)
unlink(server.pidfile);
redisLog(REDIS_WARNING,"%zu bytes used at exit",zmalloc_used_memory());
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} {
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]
} {{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