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
2a9c77a2
Commit
2a9c77a2
authored
Jan 24, 2023
by
Vitaly Arbuzov
Browse files
Aof write SELECT outside of dict loop
parent
2ed31392
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
2a9c77a2
...
...
@@ -2237,6 +2237,9 @@ int rewriteAppendOnlyFileRio(rio *aof) {
for
(
j
=
0
;
j
<
server
.
dbnum
;
j
++
)
{
char
selectcmd
[]
=
"*2
\r\n
$6
\r\n
SELECT
\r\n
"
;
/* SELECT the new DB */
if
(
rioWrite
(
aof
,
selectcmd
,
sizeof
(
selectcmd
)
-
1
)
==
0
)
goto
werr
;
if
(
rioWriteBulkLongLong
(
aof
,
j
)
==
0
)
goto
werr
;
redisDb
*
db
=
server
.
db
+
j
;
dict
*
d
;
dbIterator
dbit
;
...
...
@@ -2244,11 +2247,6 @@ int rewriteAppendOnlyFileRio(rio *aof) {
while
((
d
=
dbNextDict
(
&
dbit
)))
{
if
(
dictSize
(
d
)
==
0
)
continue
;
di
=
dictGetSafeIterator
(
d
);
/* SELECT the new DB */
if
(
rioWrite
(
aof
,
selectcmd
,
sizeof
(
selectcmd
)
-
1
)
==
0
)
goto
werr
;
if
(
rioWriteBulkLongLong
(
aof
,
j
)
==
0
)
goto
werr
;
/* Iterate this DB writing every entry */
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
sds
keystr
;
...
...
src/script.c
View file @
2a9c77a2
...
...
@@ -448,7 +448,7 @@ static int scriptVerifyClusterState(scriptRunCtx *run_ctx, client *c, client *or
* that weren't pre-declared. */
if
(
hashslot
!=
-
1
)
{
if
(
run_ctx
->
flags
&
SCRIPT_ALLOW_CROSS_SLOT
)
{
original_c
->
db
->
command_slot
=
-
1
;
/* Clear command slot for multislot scripts because script may access keys from differen slots. */
original_c
->
db
->
command_slot
=
-
1
;
/* Clear command slot for multislot scripts because script may access keys from differen
t
slots. */
}
else
{
if
(
original_c
->
slot
==
-
1
)
{
original_c
->
slot
=
hashslot
;
...
...
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