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

Function rdbPipeWriteHandlerConnRemoved

src/replication.cpp:1930–1945  ·  view source on GitHub ↗

Remove one write handler from the list of connections waiting to be writable * during rdb pipe transfer. */

Source from the content-addressed store, hash-verified

1928/* Remove one write handler from the list of connections waiting to be writable
1929 * during rdb pipe transfer. */
1930void rdbPipeWriteHandlerConnRemoved(struct connection *conn) {
1931 if (!connHasWriteHandler(conn))
1932 return;
1933 connSetWriteHandler(conn, NULL);
1934 client *slave = (client*)connGetPrivateData(conn);
1935 slave->repl_last_partial_write = 0;
1936 g_pserver->rdb_pipe_numconns_writing--;
1937 /* if there are no more writes for now for this conn, or write error: */
1938 if (g_pserver->rdb_pipe_numconns_writing == 0) {
1939 aePostFunction(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, []{
1940 if (aeCreateFileEvent(serverTL->el, g_pserver->rdb_pipe_read, AE_READABLE, rdbPipeReadHandler,NULL) == AE_ERR) {
1941 serverPanic("Unrecoverable error creating g_pserver->rdb_pipe_read file event.");
1942 }
1943 });
1944 }
1945}
1946
1947/* Called in diskless master during transfer of data from the rdb pipe, when
1948 * the replica becomes writable again. */

Callers 2

rdbPipeWriteHandlerFunction · 0.85
unlinkClientFunction · 0.85

Calls 5

connHasWriteHandlerFunction · 0.85
connSetWriteHandlerFunction · 0.85
connGetPrivateDataFunction · 0.85
aePostFunctionFunction · 0.85
aeCreateFileEventFunction · 0.85

Tested by

no test coverage detected