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

Function rdbPipeWriteHandler

app/redis-6.2.6/src/replication.c:1170–1192  ·  view source on GitHub ↗

Called in diskless master during transfer of data from the rdb pipe, when * the replica becomes writable again. */

Source from the content-addressed store, hash-verified

1168/* Called in diskless master during transfer of data from the rdb pipe, when
1169 * the replica becomes writable again. */
1170void rdbPipeWriteHandler(struct connection *conn) {
1171 serverAssert(server.rdb_pipe_bufflen>0);
1172 client *slave = connGetPrivateData(conn);
1173 int nwritten;
1174 if ((nwritten = connWrite(conn, server.rdb_pipe_buff + slave->repldboff,
1175 server.rdb_pipe_bufflen - slave->repldboff)) == -1)
1176 {
1177 if (connGetState(conn) == CONN_STATE_CONNECTED)
1178 return; /* equivalent to EAGAIN */
1179 serverLog(LL_WARNING,"Write error sending DB to replica: %s",
1180 connGetLastError(conn));
1181 freeClient(slave);
1182 return;
1183 } else {
1184 slave->repldboff += nwritten;
1185 atomicIncr(server.stat_net_output_bytes, nwritten);
1186 if (slave->repldboff < server.rdb_pipe_bufflen) {
1187 slave->repl_last_partial_write = server.unixtime;
1188 return; /* more data to write.. */
1189 }
1190 }
1191 rdbPipeWriteHandlerConnRemoved(conn);
1192}
1193
1194/* Called in diskless master, when there's data to read from the child's rdb pipe */
1195void rdbPipeReadHandler(struct aeEventLoop *eventLoop, int fd, void *clientData, int mask) {

Callers

nothing calls this directly

Calls 6

connGetPrivateDataFunction · 0.85
connWriteFunction · 0.85
connGetStateFunction · 0.85
connGetLastErrorFunction · 0.85
freeClientFunction · 0.70

Tested by

no test coverage detected