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

Function backgroundSaveDoneHandlerDisk

src/rdb.cpp:3594–3616  ·  view source on GitHub ↗

A background saving child (BGSAVE) terminated its work. Handle this. * This function covers the case of actual BGSAVEs. */

Source from the content-addressed store, hash-verified

3592/* A background saving child (BGSAVE) terminated its work. Handle this.
3593 * This function covers the case of actual BGSAVEs. */
3594static void backgroundSaveDoneHandlerDisk(int exitcode, bool fCancelled) {
3595 if (!fCancelled && exitcode == 0) {
3596 serverLog(LL_NOTICE,
3597 "Background saving terminated with success");
3598 g_pserver->dirty = g_pserver->dirty - g_pserver->dirty_before_bgsave;
3599 g_pserver->lastsave = time(NULL);
3600 g_pserver->lastbgsave_status = C_OK;
3601 latencyEndMonitor(g_pserver->rdb_save_latency);
3602 latencyAddSampleIfNeeded("rdb-save",g_pserver->rdb_save_latency);
3603 } else if (!fCancelled && exitcode != 0) {
3604 serverLog(LL_WARNING, "Background saving error");
3605 g_pserver->lastbgsave_status = C_ERR;
3606 } else {
3607 mstime_t latency;
3608
3609 serverLog(LL_WARNING,
3610 "Background saving cancelled");
3611 latencyStartMonitor(latency);
3612 rdbRemoveTempFile(g_pserver->rdbThreadVars.tmpfileNum, 0);
3613 latencyEndMonitor(latency);
3614 latencyAddSampleIfNeeded("rdb-unlink-temp-file",latency);
3615 }
3616}
3617
3618/* A background saving child (BGSAVE) terminated its work. Handle this.
3619 * This function covers the case of RDB -> Slaves socket transfers for

Callers 1

Calls 2

serverLogFunction · 0.85
rdbRemoveTempFileFunction · 0.85

Tested by

no test coverage detected