Called when the user switches from "appendonly yes" to "appendonly no" * at runtime using the CONFIG command. */
| 247 | /* Called when the user switches from "appendonly yes" to "appendonly no" |
| 248 | * at runtime using the CONFIG command. */ |
| 249 | void stopAppendOnly(void) { |
| 250 | serverAssert(g_pserver->aof_state != AOF_OFF); |
| 251 | flushAppendOnlyFile(1); |
| 252 | if (redis_fsync(g_pserver->aof_fd) == -1) { |
| 253 | serverLog(LL_WARNING,"Fail to fsync the AOF file: %s",strerror(errno)); |
| 254 | } else { |
| 255 | g_pserver->aof_fsync_offset = g_pserver->aof_current_size; |
| 256 | g_pserver->aof_last_fsync = g_pserver->unixtime; |
| 257 | } |
| 258 | close(g_pserver->aof_fd); |
| 259 | |
| 260 | g_pserver->aof_fd = -1; |
| 261 | g_pserver->aof_selected_db = -1; |
| 262 | g_pserver->aof_state = AOF_OFF; |
| 263 | g_pserver->aof_rewrite_scheduled = 0; |
| 264 | killAppendOnlyChild(); |
| 265 | sdsfree(g_pserver->aof_buf); |
| 266 | g_pserver->aof_buf = sdsempty(); |
| 267 | } |
| 268 | |
| 269 | /* Called when the user switches from "appendonly no" to "appendonly yes" |
| 270 | * at runtime using the CONFIG command. */ |
no test coverage detected