Commit eafaf172 authored by zhaozhao.zz's avatar zhaozhao.zz Committed by antirez
Browse files

AOF & RDB: be compatible with rdbchecksum no

parent 4630da37
...@@ -1649,10 +1649,11 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi) { ...@@ -1649,10 +1649,11 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi) {
decrRefCount(key); decrRefCount(key);
} }
/* Verify the checksum if RDB version is >= 5 */ /* Verify the checksum if RDB version is >= 5 */
if (rdbver >= 5 && server.rdb_checksum) { if (rdbver >= 5) {
uint64_t cksum, expected = rdb->cksum; uint64_t cksum, expected = rdb->cksum;
if (rioRead(rdb,&cksum,8) == 0) goto eoferr; if (rioRead(rdb,&cksum,8) == 0) goto eoferr;
if (server.rdb_checksum) {
memrev64ifbe(&cksum); memrev64ifbe(&cksum);
if (cksum == 0) { if (cksum == 0) {
serverLog(LL_WARNING,"RDB file was saved with checksum disabled: no check performed."); serverLog(LL_WARNING,"RDB file was saved with checksum disabled: no check performed.");
...@@ -1661,6 +1662,7 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi) { ...@@ -1661,6 +1662,7 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi) {
rdbExitReportCorruptRDB("RDB CRC error"); rdbExitReportCorruptRDB("RDB CRC error");
} }
} }
}
return C_OK; return C_OK;
eoferr: /* unexpected end of file is handled here with a fatal exit */ eoferr: /* unexpected end of file is handled here with a fatal exit */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment