Called when the user switches from "appendonly yes" to "appendonly no" * at runtime using the CONFIG command. */
| 234 | /* Called when the user switches from "appendonly yes" to "appendonly no" |
| 235 | * at runtime using the CONFIG command. */ |
| 236 | void stopAppendOnly(void) { |
| 237 | serverAssert(server.aof_state != AOF_OFF); |
| 238 | flushAppendOnlyFile(1); |
| 239 | if (redis_fsync(server.aof_fd) == -1) { |
| 240 | serverLog(LL_WARNING,"Fail to fsync the AOF file: %s",strerror(errno)); |
| 241 | } else { |
| 242 | server.aof_fsync_offset = server.aof_current_size; |
| 243 | server.aof_last_fsync = server.unixtime; |
| 244 | } |
| 245 | close(server.aof_fd); |
| 246 | |
| 247 | server.aof_fd = -1; |
| 248 | server.aof_selected_db = -1; |
| 249 | server.aof_state = AOF_OFF; |
| 250 | server.aof_rewrite_scheduled = 0; |
| 251 | killAppendOnlyChild(); |
| 252 | sdsfree(server.aof_buf); |
| 253 | server.aof_buf = sdsempty(); |
| 254 | } |
| 255 | |
| 256 | /* Called when the user switches from "appendonly no" to "appendonly yes" |
| 257 | * at runtime using the CONFIG command. */ |
no test coverage detected