forked from redis/redis
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7be7834
commit 2cbbf63
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,8 +332,6 @@ void feedReplicationBuffer(char *s, size_t len) { | |
static long long repl_block_id = 0; | ||
|
||
if (server.repl_backlog == NULL) return; | ||
server.master_repl_offset += len; | ||
server.repl_backlog->histlen += len; | ||
|
||
while(len > 0) { | ||
size_t start_pos = 0; /* The position of referenced block to start sending. */ | ||
|
@@ -354,6 +352,8 @@ void feedReplicationBuffer(char *s, size_t len) { | |
tail->used += copy; | ||
s += copy; | ||
len -= copy; | ||
server.master_repl_offset += copy; | ||
server.repl_backlog->histlen += copy; | ||
} | ||
if (len) { | ||
/* Create a new node, make sure it is allocated to at | ||
|
@@ -369,7 +369,6 @@ void feedReplicationBuffer(char *s, size_t len) { | |
size_t copy = (tail->size >= len) ? len : tail->size; | ||
tail->used = copy; | ||
tail->refcount = 0; | ||
tail->repl_offset = server.master_repl_offset - tail->used + 1; | ||
tail->id = repl_block_id++; | ||
memcpy(tail->buf, s, copy); | ||
listAddNodeTail(server.repl_buffer_blocks, tail); | ||
|
@@ -382,6 +381,9 @@ void feedReplicationBuffer(char *s, size_t len) { | |
} | ||
s += copy; | ||
len -= copy; | ||
server.master_repl_offset += copy; | ||
server.repl_backlog->histlen += copy; | ||
tail->repl_offset = server.master_repl_offset - tail->used + 1; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
enjoy-binbin
Author
Owner
|
||
} | ||
|
||
/* For output buffer of replicas. */ | ||
|
It can be changed to
tail->repl_offset = server.master_repl_offset + 1;
and moved to aftertail->refcount = 0;
.