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
6cba1239
Commit
6cba1239
authored
Feb 28, 2018
by
antirez
Browse files
WAIT AOF: deny if AOF is off. Trigger sync in proper place.
parent
d69fc0d7
Changes
2
Show whitespace changes
Inline
Side-by-side
src/replication.c
View file @
6cba1239
...
@@ -2404,6 +2404,10 @@ void waitCommand(client *c) {
...
@@ -2404,6 +2404,10 @@ void waitCommand(client *c) {
/* AOF or number of replicas argument parsing. */
/* AOF or number of replicas argument parsing. */
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"AOF"
))
{
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"AOF"
))
{
waitaof
=
1
;
waitaof
=
1
;
if
(
server
.
aof_state
!=
AOF_ON
)
{
addReplyError
(
c
,
"WAIT AOF is only allowed when AOF is enabled"
);
return
;
}
}
else
{
}
else
{
if
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
1
],
&
numreplicas
,
NULL
)
!=
C_OK
)
if
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
1
],
&
numreplicas
,
NULL
)
!=
C_OK
)
return
;
return
;
...
@@ -2495,11 +2499,6 @@ void processClientsBlockedInWait(void) {
...
@@ -2495,11 +2499,6 @@ void processClientsBlockedInWait(void) {
}
}
}
}
}
}
/* If after this cycle we have still clients blocked, try to start
* a new AOF fsync. If one is already in progress nothig will happen. */
if
(
server
.
blocked_clients_by_type
[
BLOCKED_AOF
])
aofStartBackgroundFsync
();
}
}
/* Return the slave replication offset for this instance, that is
/* Return the slave replication offset for this instance, that is
...
...
src/server.c
View file @
6cba1239
...
@@ -1230,9 +1230,19 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
...
@@ -1230,9 +1230,19 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
/* Unblock all the clients blocked for synchronous replication
/* Unblock all the clients blocked for synchronous replication
* or AOF sync in WAIT. */
* or AOF sync in WAIT. */
if
(
listLength
(
server
.
clients_waiting_acks
))
if
(
listLength
(
server
.
clients_waiting_acks
))
{
processClientsBlockedInWait
();
processClientsBlockedInWait
();
/* If after this cycle we have still clients blocked waiting for
* AOF fsync, try to start a new sync cycle. Note that if one is
* already in progress, the call does nothing. */
if
(
server
.
blocked_clients_by_type
[
BLOCKED_AOF
]
&&
server
.
aof_state
==
AOF_ON
)
{
aofStartBackgroundFsync
();
}
}
/* Check if there are clients unblocked by modules that implement
/* Check if there are clients unblocked by modules that implement
* blocking commands. */
* blocking commands. */
moduleHandleBlockedClients
();
moduleHandleBlockedClients
();
...
...
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