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.
This commit is contained in:
Wang Yuan 2021-06-28 14:43:40 +08:00 committed by GitHub
parent 1071430875
commit 4fa3e23092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,7 +463,7 @@ long long addReplyReplicationBacklog(client *c, long long offset) {
(server.repl_backlog_size - j) : len;
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;
j = 0;
}