MCPcopy Create free account
hub / github.com/F-Stack/f-stack / backgroundSaveDoneHandlerDisk

Function backgroundSaveDoneHandlerDisk

app/redis-6.2.6/src/rdb.c:2770–2794  ·  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

2768/* A background saving child (BGSAVE) terminated its work. Handle this.
2769 * This function covers the case of actual BGSAVEs. */
2770static void backgroundSaveDoneHandlerDisk(int exitcode, int bysignal) {
2771 if (!bysignal && exitcode == 0) {
2772 serverLog(LL_NOTICE,
2773 "Background saving terminated with success");
2774 server.dirty = server.dirty - server.dirty_before_bgsave;
2775 server.lastsave = time(NULL);
2776 server.lastbgsave_status = C_OK;
2777 } else if (!bysignal && exitcode != 0) {
2778 serverLog(LL_WARNING, "Background saving error");
2779 server.lastbgsave_status = C_ERR;
2780 } else {
2781 mstime_t latency;
2782
2783 serverLog(LL_WARNING,
2784 "Background saving terminated by signal %d", bysignal);
2785 latencyStartMonitor(latency);
2786 rdbRemoveTempFile(server.child_pid, 0);
2787 latencyEndMonitor(latency);
2788 latencyAddSampleIfNeeded("rdb-unlink-temp-file",latency);
2789 /* SIGUSR1 is whitelisted, so we have a way to kill a child without
2790 * triggering an error condition. */
2791 if (bysignal != SIGUSR1)
2792 server.lastbgsave_status = C_ERR;
2793 }
2794}
2795
2796/* A background saving child (BGSAVE) terminated its work. Handle this.
2797 * This function covers the case of RDB -> Slaves socket transfers for

Callers 1

Calls 1

rdbRemoveTempFileFunction · 0.85

Tested by

no test coverage detected