mirror of
https://github.com/fluencelabs/redis
synced 2025-05-14 19:41:21 +00:00
parent
b72422e100
commit
33daf8e9a9
16
src/aof.c
16
src/aof.c
@ -73,7 +73,7 @@ void aofRewriteBufferReset(void) {
|
|||||||
listSetFreeMethod(server.aof_rewrite_buf_blocks,zfree);
|
listSetFreeMethod(server.aof_rewrite_buf_blocks,zfree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the current size of the AOF rerwite buffer. */
|
/* Return the current size of the AOF rewite buffer. */
|
||||||
unsigned long aofRewriteBufferSize(void) {
|
unsigned long aofRewriteBufferSize(void) {
|
||||||
listNode *ln = listLast(server.aof_rewrite_buf_blocks);
|
listNode *ln = listLast(server.aof_rewrite_buf_blocks);
|
||||||
aofrwblock *block = ln ? ln->value : NULL;
|
aofrwblock *block = ln ? ln->value : NULL;
|
||||||
@ -202,7 +202,7 @@ int startAppendOnly(void) {
|
|||||||
redisLog(REDIS_WARNING,"Redis needs to enable the AOF but can't trigger a background AOF rewrite operation. Check the above logs for more info about the error.");
|
redisLog(REDIS_WARNING,"Redis needs to enable the AOF but can't trigger a background AOF rewrite operation. Check the above logs for more info about the error.");
|
||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
}
|
}
|
||||||
/* We correctly switched on AOF, now wait for the rerwite to be complete
|
/* We correctly switched on AOF, now wait for the rewite to be complete
|
||||||
* in order to append data on disk. */
|
* in order to append data on disk. */
|
||||||
server.aof_state = REDIS_AOF_WAIT_REWRITE;
|
server.aof_state = REDIS_AOF_WAIT_REWRITE;
|
||||||
return REDIS_OK;
|
return REDIS_OK;
|
||||||
@ -243,7 +243,7 @@ void flushAppendOnlyFile(int force) {
|
|||||||
* the write for a couple of seconds. */
|
* the write for a couple of seconds. */
|
||||||
if (sync_in_progress) {
|
if (sync_in_progress) {
|
||||||
if (server.aof_flush_postponed_start == 0) {
|
if (server.aof_flush_postponed_start == 0) {
|
||||||
/* No previous write postponinig, remember that we are
|
/* No previous write postponing, remember that we are
|
||||||
* postponing the flush and return. */
|
* postponing the flush and return. */
|
||||||
server.aof_flush_postponed_start = server.unixtime;
|
server.aof_flush_postponed_start = server.unixtime;
|
||||||
return;
|
return;
|
||||||
@ -294,7 +294,7 @@ void flushAppendOnlyFile(int force) {
|
|||||||
last_write_error_log = server.unixtime;
|
last_write_error_log = server.unixtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lof the AOF write error and record the error code. */
|
/* Log the AOF write error and record the error code. */
|
||||||
if (nwritten == -1) {
|
if (nwritten == -1) {
|
||||||
if (can_log) {
|
if (can_log) {
|
||||||
redisLog(REDIS_WARNING,"Error writing to the AOF file: %s",
|
redisLog(REDIS_WARNING,"Error writing to the AOF file: %s",
|
||||||
@ -318,7 +318,7 @@ void flushAppendOnlyFile(int force) {
|
|||||||
"ftruncate: %s", strerror(errno));
|
"ftruncate: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If the ftrunacate() succeeded we can set nwritten to
|
/* If the ftruncate() succeeded we can set nwritten to
|
||||||
* -1 since there is no longer partial data into the AOF. */
|
* -1 since there is no longer partial data into the AOF. */
|
||||||
nwritten = -1;
|
nwritten = -1;
|
||||||
}
|
}
|
||||||
@ -330,7 +330,7 @@ void flushAppendOnlyFile(int force) {
|
|||||||
/* We can't recover when the fsync policy is ALWAYS since the
|
/* We can't recover when the fsync policy is ALWAYS since the
|
||||||
* reply for the client is already in the output buffers, and we
|
* reply for the client is already in the output buffers, and we
|
||||||
* have the contract with the user that on acknowledged write data
|
* have the contract with the user that on acknowledged write data
|
||||||
* is synched on disk. */
|
* is synced on disk. */
|
||||||
redisLog(REDIS_WARNING,"Can't recover from AOF write error when the AOF fsync policy is 'always'. Exiting...");
|
redisLog(REDIS_WARNING,"Can't recover from AOF write error when the AOF fsync policy is 'always'. Exiting...");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
@ -425,7 +425,7 @@ sds catAppendOnlyExpireAtCommand(sds buf, struct redisCommand *cmd, robj *key, r
|
|||||||
long long when;
|
long long when;
|
||||||
robj *argv[3];
|
robj *argv[3];
|
||||||
|
|
||||||
/* Make sure we can use strtol */
|
/* Make sure we can use strtoll */
|
||||||
seconds = getDecodedObject(seconds);
|
seconds = getDecodedObject(seconds);
|
||||||
when = strtoll(seconds->ptr,NULL,10);
|
when = strtoll(seconds->ptr,NULL,10);
|
||||||
/* Convert argument into milliseconds for EXPIRE, SETEX, EXPIREAT */
|
/* Convert argument into milliseconds for EXPIRE, SETEX, EXPIREAT */
|
||||||
@ -456,7 +456,7 @@ void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int a
|
|||||||
robj *tmpargv[3];
|
robj *tmpargv[3];
|
||||||
|
|
||||||
/* The DB this command was targeting is not the same as the last command
|
/* The DB this command was targeting is not the same as the last command
|
||||||
* we appendend. To issue a SELECT command is needed. */
|
* we appended. To issue a SELECT command is needed. */
|
||||||
if (dictid != server.aof_selected_db) {
|
if (dictid != server.aof_selected_db) {
|
||||||
char seldb[64];
|
char seldb[64];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user