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
42b2621c
Commit
42b2621c
authored
Mar 28, 2011
by
antirez
Browse files
implemented preload of EXEC using the new getKeys() system
parent
a3cf9041
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dscache.c
View file @
42b2621c
...
@@ -969,14 +969,33 @@ void execBlockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd, int
...
@@ -969,14 +969,33 @@ void execBlockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd, int
* Return 1 if the client is marked as blocked, 0 if the client can
* Return 1 if the client is marked as blocked, 0 if the client can
* continue as the keys it is going to access appear to be in memory. */
* continue as the keys it is going to access appear to be in memory. */
int
blockClientOnSwappedKeys
(
redisClient
*
c
,
struct
redisCommand
*
cmd
)
{
int
blockClientOnSwappedKeys
(
redisClient
*
c
,
struct
redisCommand
*
cmd
)
{
int
*
keyindex
,
numkeys
,
j
;
int
*
keyindex
,
numkeys
,
j
,
i
;
keyindex
=
getKeysFromCommand
(
cmd
,
c
->
argv
,
c
->
argc
,
&
numkeys
,
/* EXEC is a special case, we need to preload all the commands
REDIS_GETKEYS_PRELOAD
);
* queued into the transaction */
for
(
j
=
0
;
j
<
numkeys
;
j
++
)
waitForSwappedKey
(
c
,
c
->
argv
[
keyindex
[
j
]]);
if
(
cmd
->
proc
==
execCommand
)
{
getKeysFreeResult
(
keyindex
);
struct
redisCommand
*
mcmd
;
robj
**
margv
;
#warning "Handle EXEC here"
int
margc
;
if
(
!
(
c
->
flags
&
REDIS_MULTI
))
return
0
;
for
(
i
=
0
;
i
<
c
->
mstate
.
count
;
i
++
)
{
mcmd
=
c
->
mstate
.
commands
[
i
].
cmd
;
margc
=
c
->
mstate
.
commands
[
i
].
argc
;
margv
=
c
->
mstate
.
commands
[
i
].
argv
;
keyindex
=
getKeysFromCommand
(
mcmd
,
margv
,
margc
,
&
numkeys
,
REDIS_GETKEYS_PRELOAD
);
for
(
j
=
0
;
j
<
numkeys
;
j
++
)
waitForSwappedKey
(
c
,
margv
[
keyindex
[
j
]]);
getKeysFreeResult
(
keyindex
);
}
}
else
{
keyindex
=
getKeysFromCommand
(
cmd
,
c
->
argv
,
c
->
argc
,
&
numkeys
,
REDIS_GETKEYS_PRELOAD
);
for
(
j
=
0
;
j
<
numkeys
;
j
++
)
waitForSwappedKey
(
c
,
c
->
argv
[
keyindex
[
j
]]);
getKeysFreeResult
(
keyindex
);
}
/* If the client was blocked for at least one key, mark it as blocked. */
/* If the client was blocked for at least one key, mark it as blocked. */
if
(
listLength
(
c
->
io_keys
))
{
if
(
listLength
(
c
->
io_keys
))
{
...
...
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