Unverified Commit 4fa3e230 authored by Wang Yuan's avatar Wang Yuan Committed by GitHub
Browse files

Remove unnecessary replication backlog memory copy (#9157)

in the past, the reply list was a list of sds objects, so this didn't have any overhead,
but now addReplySds just copies the data from the sds and frees it, so there's no
need to make a copy of the buffer before copying again.
this reduces an excessive allocation and free and a memcpy.
parent 10714308
...@@ -463,7 +463,7 @@ long long addReplyReplicationBacklog(client *c, long long offset) { ...@@ -463,7 +463,7 @@ long long addReplyReplicationBacklog(client *c, long long offset) {
(server.repl_backlog_size - j) : len; (server.repl_backlog_size - j) : len;
serverLog(LL_DEBUG, "[PSYNC] addReply() length: %lld", thislen); serverLog(LL_DEBUG, "[PSYNC] addReply() length: %lld", thislen);
addReplySds(c,sdsnewlen(server.repl_backlog + j, thislen)); addReplyProto(c,server.repl_backlog + j, thislen);
len -= thislen; len -= thislen;
j = 0; j = 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment