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
55003f7a
Commit
55003f7a
authored
Feb 09, 2015
by
antirez
Browse files
alsoPropagate: handle REDIS_CALL_PROPAGATE and AOF loading.
parent
cc7f0434
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
55003f7a
...
@@ -2030,9 +2030,12 @@ void propagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
...
@@ -2030,9 +2030,12 @@ void propagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
void
alsoPropagate
(
struct
redisCommand
*
cmd
,
int
dbid
,
robj
**
argv
,
int
argc
,
void
alsoPropagate
(
struct
redisCommand
*
cmd
,
int
dbid
,
robj
**
argv
,
int
argc
,
int
target
)
int
target
)
{
{
robj
**
argvcopy
=
zmalloc
(
sizeof
(
robj
*
)
*
argc
)
;
robj
**
argvcopy
;
int
j
;
int
j
;
if
(
server
.
loading
)
return
;
/* No propagation during loading. */
argvcopy
=
zmalloc
(
sizeof
(
robj
*
)
*
argc
);
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
argvcopy
[
j
]
=
argv
[
j
];
argvcopy
[
j
]
=
argv
[
j
];
incrRefCount
(
argv
[
j
]);
incrRefCount
(
argv
[
j
]);
...
@@ -2132,9 +2135,11 @@ void call(redisClient *c, int flags) {
...
@@ -2132,9 +2135,11 @@ void call(redisClient *c, int flags) {
int
j
;
int
j
;
redisOp
*
rop
;
redisOp
*
rop
;
for
(
j
=
0
;
j
<
server
.
also_propagate
.
numops
;
j
++
)
{
if
(
flags
&
REDIS_CALL_PROPAGATE
)
{
rop
=
&
server
.
also_propagate
.
ops
[
j
];
for
(
j
=
0
;
j
<
server
.
also_propagate
.
numops
;
j
++
)
{
propagate
(
rop
->
cmd
,
rop
->
dbid
,
rop
->
argv
,
rop
->
argc
,
rop
->
target
);
rop
=
&
server
.
also_propagate
.
ops
[
j
];
propagate
(
rop
->
cmd
,
rop
->
dbid
,
rop
->
argv
,
rop
->
argc
,
rop
->
target
);
}
}
}
redisOpArrayFree
(
&
server
.
also_propagate
);
redisOpArrayFree
(
&
server
.
also_propagate
);
}
}
...
...
tests/integration/aof.tcl
View file @
55003f7a
...
@@ -204,7 +204,7 @@ tags {"aof"} {
...
@@ -204,7 +204,7 @@ tags {"aof"} {
}
}
}
}
##
Test that SPOP with <count>
(
that modifies the client's argc/argv
)
is correctly free'd
##
Uses the alsoPropagate
()
API.
create_aof
{
create_aof
{
append_to_aof
[
formatCommand sadd set foo
]
append_to_aof
[
formatCommand sadd set foo
]
append_to_aof
[
formatCommand sadd set bar
]
append_to_aof
[
formatCommand sadd set bar
]
...
...
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