Skip to content

Commit 4aad7d5

Browse files
committed
Skip expiry check when now=0 for valkey-check-rdb
Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
1 parent b57352c commit 4aad7d5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/rdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2246,7 +2246,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd
22462246

22472247
/* If this is a non-preamble RDB being loaded on the primary, and this
22482248
* field is already expired relative to 'now', skip it. */
2249-
if (iAmPrimary() && !(rdbflags & RDBFLAGS_AOF_PREAMBLE) &&
2249+
if (iAmPrimary() && !(rdbflags & RDBFLAGS_AOF_PREAMBLE) && now != 0 &&
22502250
itemexpiry != EXPIRY_NONE && itemexpiry < now) {
22512251
/* Emit HDEL to replicas. */
22522252
if ((rdbflags & RDBFLAGS_FEED_REPL) && server.repl_backlog) {

src/valkey-check-rdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) {
788788
rdbstate.keys++;
789789
/* Read value */
790790
rdbstate.doing = RDB_CHECK_DOING_READ_OBJECT_VALUE;
791-
if ((val = rdbLoadObject(type, &rdb, objectGetVal(key), selected_dbid, NULL, RDBFLAGS_NONE, now)) == NULL) goto eoferr;
791+
if ((val = rdbLoadObject(type, &rdb, objectGetVal(key), selected_dbid, NULL, RDBFLAGS_NONE, 0)) == NULL) goto eoferr;
792792
if (rdbCheckStats) {
793793
int max_stats_num = (rdbstate.databases + 1) * OBJ_TYPE_MAX;
794794
if (max_stats_num > rdbstate.stats_num) {

0 commit comments

Comments
 (0)