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

Function replicationSendNewlineToMaster

src/replication.cpp:2318–2325  ·  view source on GitHub ↗

Avoid the master to detect the replica is timing out while loading the * RDB file in initial synchronization. We send a single newline character * that is valid protocol but is guaranteed to either be sent entirely or * not, since the byte is indivisible. * * The function is called in two contexts: while we flush the current * data with emptyDb(), and while we load the new data received as a

Source from the content-addressed store, hash-verified

2316 * data with emptyDb(), and while we load the new data received as an
2317 * RDB file from the master. */
2318void replicationSendNewlineToMaster(redisMaster *mi) {
2319 static time_t newline_sent;
2320 if (time(NULL) != newline_sent) {
2321 newline_sent = time(NULL);
2322 /* Pinging back in this stage is best-effort. */
2323 if (mi->repl_transfer_s) connWrite(mi->repl_transfer_s, "\n", 1);
2324 }
2325}
2326
2327/* Callback used by emptyDb() while flushing away old data to load
2328 * the new dataset received by the master. */

Callers 3

ProcessWhileBlockedMethod · 0.85
rdbLoadProgressCallbackFunction · 0.85

Calls 1

connWriteFunction · 0.85

Tested by

no test coverage detected