MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / stopAppendOnly

Function stopAppendOnly

src/aof.cpp:249–267  ·  view source on GitHub ↗

Called when the user switches from "appendonly yes" to "appendonly no" * at runtime using the CONFIG command. */

Source from the content-addressed store, hash-verified

247/* Called when the user switches from "appendonly yes" to "appendonly no"
248 * at runtime using the CONFIG command. */
249void 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. */

Callers 4

readSnapshotBulkPayloadFunction · 0.85
readSyncBulkPayloadRdbFunction · 0.85
RM_ResetDatasetFunction · 0.85
updateAppendonlyFunction · 0.85

Calls 5

flushAppendOnlyFileFunction · 0.85
serverLogFunction · 0.85
killAppendOnlyChildFunction · 0.85
sdsfreeFunction · 0.85
sdsemptyFunction · 0.85

Tested by

no test coverage detected