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
edb92db5
Commit
edb92db5
authored
May 08, 2018
by
zhaozhao.zz
Browse files
AOF & RDB: be compatible with rdbchecksum no
parent
aba76320
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
edb92db5
...
...
@@ -2009,16 +2009,18 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi) {
lru_idle
=
-
1
;
}
/* Verify the checksum if RDB version is >= 5 */
if
(
rdbver
>=
5
&&
server
.
rdb_checksum
)
{
if
(
rdbver
>=
5
)
{
uint64_t
cksum
,
expected
=
rdb
->
cksum
;
if
(
rioRead
(
rdb
,
&
cksum
,
8
)
==
0
)
goto
eoferr
;
memrev64ifbe
(
&
cksum
);
if
(
cksum
==
0
)
{
serverLog
(
LL_WARNING
,
"RDB file was saved with checksum disabled: no check performed."
);
}
else
if
(
cksum
!=
expected
)
{
serverLog
(
LL_WARNING
,
"Wrong RDB checksum. Aborting now."
);
rdbExitReportCorruptRDB
(
"RDB CRC error"
);
if
(
server
.
rdb_checksum
)
{
memrev64ifbe
(
&
cksum
);
if
(
cksum
==
0
)
{
serverLog
(
LL_WARNING
,
"RDB file was saved with checksum disabled: no check performed."
);
}
else
if
(
cksum
!=
expected
)
{
serverLog
(
LL_WARNING
,
"Wrong RDB checksum. Aborting now."
);
rdbExitReportCorruptRDB
(
"RDB CRC error"
);
}
}
}
return
C_OK
;
...
...
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