Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f6c65d3f
Commit
f6c65d3f
authored
Aug 05, 2015
by
antirez
Browse files
syncCommand() comments improved.
parent
9d297218
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/replication.c
View file @
f6c65d3f
...
@@ -544,6 +544,8 @@ void syncCommand(redisClient *c) {
...
@@ -544,6 +544,8 @@ void syncCommand(redisClient *c) {
/* Here we need to check if there is a background saving operation
/* Here we need to check if there is a background saving operation
* in progress, or if it is required to start one */
* in progress, or if it is required to start one */
/* CASE 1: BGSAVE is in progress and replication target is disk. */
if
(
server
.
rdb_child_pid
!=
-
1
&&
if
(
server
.
rdb_child_pid
!=
-
1
&&
server
.
rdb_child_type
==
REDIS_RDB_CHILD_TYPE_DISK
)
server
.
rdb_child_type
==
REDIS_RDB_CHILD_TYPE_DISK
)
{
{
...
@@ -572,6 +574,8 @@ void syncCommand(redisClient *c) {
...
@@ -572,6 +574,8 @@ void syncCommand(redisClient *c) {
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_START
;
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_START
;
redisLog
(
REDIS_NOTICE
,
"Waiting for next BGSAVE for SYNC"
);
redisLog
(
REDIS_NOTICE
,
"Waiting for next BGSAVE for SYNC"
);
}
}
/* CASE 2: BGSAVE is in progress and replication target is socket. */
}
else
if
(
server
.
rdb_child_pid
!=
-
1
&&
}
else
if
(
server
.
rdb_child_pid
!=
-
1
&&
server
.
rdb_child_type
==
REDIS_RDB_CHILD_TYPE_SOCKET
)
server
.
rdb_child_type
==
REDIS_RDB_CHILD_TYPE_SOCKET
)
{
{
...
@@ -580,6 +584,8 @@ void syncCommand(redisClient *c) {
...
@@ -580,6 +584,8 @@ void syncCommand(redisClient *c) {
* in order to synchronize. */
* in order to synchronize. */
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_START
;
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_START
;
redisLog
(
REDIS_NOTICE
,
"Waiting for next BGSAVE for SYNC"
);
redisLog
(
REDIS_NOTICE
,
"Waiting for next BGSAVE for SYNC"
);
/* CASE 3: There is no BGSAVE is progress. */
}
else
{
}
else
{
if
(
server
.
repl_diskless_sync
)
{
if
(
server
.
repl_diskless_sync
)
{
/* Diskless replication RDB child is created inside
/* Diskless replication RDB child is created inside
...
@@ -589,7 +595,8 @@ void syncCommand(redisClient *c) {
...
@@ -589,7 +595,8 @@ void syncCommand(redisClient *c) {
if
(
server
.
repl_diskless_sync_delay
)
if
(
server
.
repl_diskless_sync_delay
)
redisLog
(
REDIS_NOTICE
,
"Delay next BGSAVE for SYNC"
);
redisLog
(
REDIS_NOTICE
,
"Delay next BGSAVE for SYNC"
);
}
else
{
}
else
{
/* Ok we don't have a BGSAVE in progress, let's start one. */
/* Target is disk and we don't have a BGSAVE in progress,
* let's start one. */
if
(
startBgsaveForReplication
()
!=
REDIS_OK
)
{
if
(
startBgsaveForReplication
()
!=
REDIS_OK
)
{
redisLog
(
REDIS_NOTICE
,
"Replication failed, can't BGSAVE"
);
redisLog
(
REDIS_NOTICE
,
"Replication failed, can't BGSAVE"
);
addReplyError
(
c
,
"Unable to perform background save"
);
addReplyError
(
c
,
"Unable to perform background save"
);
...
...
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