Set TCP_NODELAY and keepalive on the master connection after PSYNC (#16020)

After PSYNC, the cached master client is reused on the new connection,
which never goes through createClient(). So TCP_NODELAY and keepalive
are not set, and Nagle can delay REPLCONF ACK by ~40ms (WAIT latency).
This commit is contained in:
Ozan Tezcan authored and GitHub committed 2026-10-21 10:21:43 +03:00
1 parent f2a17a8dca
commit c38dcdabf4
1 file changed
+3
+3
View File
@@ -4756,6 +4756,9 @@ void replicationResurrectCachedMaster(connection *conn) {
server.master = server.cached_master;
server.cached_master = NULL;
server.master->conn = conn;
connEnableTcpNoDelay(conn);
if (server.tcpkeepalive)
connKeepAlive(conn,server.tcpkeepalive);
connSetPrivateData(server.master->conn, server.master);
server.master->flags &= ~(CLIENT_CLOSE_AFTER_REPLY|CLIENT_CLOSE_ASAP);
server.master->authenticated = 1;