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
8063b99d
Commit
8063b99d
authored
May 06, 2010
by
Pieter Noordhuis
Browse files
log error and quit when the AOF contains an unfinished MULTI
parent
98d2e23b
Changes
1
Show whitespace changes
Inline
Side-by-side
redis.c
View file @
8063b99d
...
...
@@ -8111,12 +8111,14 @@ static struct redisClient *createFakeClient(void) {
c
->
reply
=
listCreate
();
listSetFreeMethod
(
c
->
reply
,
decrRefCount
);
listSetDupMethod
(
c
->
reply
,
dupClientReplyValue
);
initClientMultiState
(
c
);
return
c
;
}
static
void
freeFakeClient
(
struct
redisClient
*
c
)
{
sdsfree
(
c
->
querybuf
);
listRelease
(
c
->
reply
);
freeClientMultiState
(
c
);
zfree
(
c
);
}
...
...
@@ -8128,6 +8130,7 @@ int loadAppendOnlyFile(char *filename) {
FILE
*
fp
=
fopen
(
filename
,
"r"
);
struct
redis_stat
sb
;
unsigned
long
long
loadedkeys
=
0
;
int
appendonly
=
server
.
appendonly
;
if
(
redis_fstat
(
fileno
(
fp
),
&
sb
)
!=
-
1
&&
sb
.
st_size
==
0
)
return
REDIS_ERR
;
...
...
@@ -8137,6 +8140,10 @@ int loadAppendOnlyFile(char *filename) {
exit
(
1
);
}
/* Temporarily disable AOF, to prevent EXEC from feeding a MULTI
* to the same file we're about to read. */
server
.
appendonly
=
0
;
fakeClient
=
createFakeClient
();
while
(
1
)
{
int
argc
,
j
;
...
...
@@ -8192,8 +8199,14 @@ int loadAppendOnlyFile(char *filename) {
}
}
}
/* This point can only be reached when EOF is reached without errors.
* If the client is in the middle of a MULTI/EXEC, log error and quit. */
if
(
fakeClient
->
flags
&
REDIS_MULTI
)
goto
readerr
;
fclose
(
fp
);
freeFakeClient
(
fakeClient
);
server
.
appendonly
=
appendonly
;
return
REDIS_OK
;
readerr:
...
...
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