Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
7c531eb5
Commit
7c531eb5
authored
Dec 10, 2013
by
antirez
Browse files
Don't send more than 1 newline/sec while loading RDB.
parent
27db38d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
7c531eb5
...
...
@@ -1066,13 +1066,17 @@ void rdbLoadProgressCallback(rio *r, const void *buf, size_t len) {
(
r
->
processed_bytes
+
len
)
/
server
.
loading_process_events_interval_bytes
>
r
->
processed_bytes
/
server
.
loading_process_events_interval_bytes
)
{
if
(
server
.
masterhost
&&
server
.
repl_state
==
REDIS_REPL_TRANSFER
)
{
static
time_t
newline_sent
;
/* Avoid the master to detect the slave is timing out while
* loading the RDB file in initial synchronization. We send
* a single newline character that is valid protocol but is
* guaranteed to either be sent entierly or not, since the byte
* is indivisible. */
if
(
write
(
server
.
repl_transfer_s
,
"
\n
"
,
1
)
==
-
1
)
{
/* Pinging back in this stage is best-effort. */
if
(
time
(
NULL
)
!=
newline_sent
)
{
newline_sent
=
time
(
NULL
);
if
(
write
(
server
.
repl_transfer_s
,
"
\n
"
,
1
)
==
-
1
)
{
/* Pinging back in this stage is best-effort. */
}
}
}
loadingProgress
(
r
->
processed_bytes
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment