mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
don't fsync after a rewrite if appendfsync is set to no. use aof_fsycn instead of fsync where appropriate
This commit is contained in:
parent
38db91713c
commit
b0bd87f60c
8
redis.c
8
redis.c
@ -1386,7 +1386,7 @@ void backgroundRewriteDoneHandler(int statloc) {
|
|||||||
/* If append only is actually enabled... */
|
/* If append only is actually enabled... */
|
||||||
close(server.appendfd);
|
close(server.appendfd);
|
||||||
server.appendfd = fd;
|
server.appendfd = fd;
|
||||||
fsync(fd);
|
if (appendfsync != APPENDFSYNC_NO) aof_fsync(fd);
|
||||||
server.appendseldb = -1; /* Make sure it will issue SELECT */
|
server.appendseldb = -1; /* Make sure it will issue SELECT */
|
||||||
redisLog(REDIS_NOTICE,"The new append only file was selected for future appends.");
|
redisLog(REDIS_NOTICE,"The new append only file was selected for future appends.");
|
||||||
} else {
|
} else {
|
||||||
@ -4200,7 +4200,7 @@ static int prepareForShutdown() {
|
|||||||
}
|
}
|
||||||
if (server.appendonly) {
|
if (server.appendonly) {
|
||||||
/* Append only file: fsync() the AOF and exit */
|
/* Append only file: fsync() the AOF and exit */
|
||||||
fsync(server.appendfd);
|
aof_fsync(server.appendfd);
|
||||||
if (server.vm_enabled) unlink(server.vm_swap_file);
|
if (server.vm_enabled) unlink(server.vm_swap_file);
|
||||||
} else {
|
} else {
|
||||||
/* Snapshotting. Perform a SYNC SAVE and exit */
|
/* Snapshotting. Perform a SYNC SAVE and exit */
|
||||||
@ -8686,7 +8686,7 @@ static int rewriteAppendOnlyFile(char *filename) {
|
|||||||
|
|
||||||
/* Make sure data will not remain on the OS's output buffers */
|
/* Make sure data will not remain on the OS's output buffers */
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
fsync(fileno(fp));
|
aof_fsync(fileno(fp));
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* Use RENAME to make sure the DB file is changed atomically only
|
/* Use RENAME to make sure the DB file is changed atomically only
|
||||||
@ -8803,7 +8803,7 @@ static void aofRemoveTempFile(pid_t childpid) {
|
|||||||
* at runtime using the CONFIG command. */
|
* at runtime using the CONFIG command. */
|
||||||
static void stopAppendOnly(void) {
|
static void stopAppendOnly(void) {
|
||||||
flushAppendOnlyFile();
|
flushAppendOnlyFile();
|
||||||
fsync(server.appendfd);
|
aof_fsync(server.appendfd);
|
||||||
close(server.appendfd);
|
close(server.appendfd);
|
||||||
|
|
||||||
server.appendfd = -1;
|
server.appendfd = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user