summaryrefslogtreecommitdiff
path: root/src/t_set.c
diff options
context:
space:
mode:
authorzhaozhao.zz <276441700@qq.com>2021-01-29 14:35:10 +0800
committerGitHub <noreply@github.com>2021-01-29 14:35:10 +0800
commit49b36633324074edd3e06c334d23562edc49159d (patch)
treef00b86007d129bf004aba2d12ee9216c73c98087 /src/t_set.c
parent0d18a1e85fdb9967419dc9f7a5905452d065c84a (diff)
downloadredis-49b36633324074edd3e06c334d23562edc49159d.tar.gz
AOF: recover from last write error after turn on appendonly again (#8030)
The key point is how to recover from last AOF write error, for example: 1. start redis with appendonly yes, and append some write commands 2. short write or something else error happen, `server.aof_last_write_status` changed to `C_ERR`, now redis doesn't accept write commands 3. execute `CONFIG SET appendonly no` to avoid the above problem, now redis can accept write commands again 4. disk error resolved, and execute `CONFIG SET appendonly yes` to reopen AOF, but `server.aof_last_write_status` cannot be changed to `C_OK` (if background aof rewrite run less then 1 second, it will free `server.aof_buf` and then serverCron cannot fix `aof_last_write_status`), then redis cannot accept write commands forever. This PR use a simple way to fix it: 1. just free `server.aof_buf` when stop appendonly to save memory, if error happens in `flushAppendOnlyFile(1)`, the `server.aof_buf` may contains some data which has not be written to aof, I think we can ignore it because we turn off the appendonly. 2. reset fsync status after stop appendonly and call `flushAppendOnlyFile` only when `aof_state` is ON 3. reset `server.last_write_status` when reopen aof to accept write commands
Diffstat (limited to 'src/t_set.c')
0 files changed, 0 insertions, 0 deletions