diff options
author | Joe Hu <jowhuw@amazon.com> | 2023-04-17 14:05:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 21:05:36 +0300 |
commit | 644d94558a739656f81343f3b8a12205d53eeeb7 (patch) | |
tree | 50e88486643de035ed887f6dcc27fb0e5498245c /src/rdb.c | |
parent | e7f18432b8e9e1d1998d3a898006497e6c5e5a32 (diff) | |
download | redis-644d94558a739656f81343f3b8a12205d53eeeb7.tar.gz |
Fix RDB check regression caused by PR 12022 (#12051)
The nightly tests showed that the recent PR #12022 caused random failures
in aof.tcl on checking RDB preamble inside an AOF file.
Root cause:
When checking RDB preamble in an AOF file, what's passed into redis_check_rdb is
aof_filename, not aof_filepath. The newly introduced isFifo function does not check return
status of the stat call and hence uses the uninitailized stat_p object.
Fix:
1. Fix isFifo by checking stat call's return code.
2. Pass aof_filepath instead of aof_filename to redis_check_rdb.
3. move the FIFO check to rdb.c since the limitation is the re-opening of the file, and not
anything specific about redis-check-rdb.
Diffstat (limited to 'src/rdb.c')
-rw-r--r-- | src/rdb.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -88,6 +88,11 @@ void rdbReportError(int corruption_error, int linenum, char *reason, ...) { /* If we're loading an rdb file form disk, run rdb check (and exit) */ serverLog(LL_WARNING, "%s", msg); char *argv[2] = {"",rdbFileBeingLoaded}; + if (anetIsFifo(argv[1])) { + /* Cannot check RDB FIFO because we cannot reopen the FIFO and check already streamed data. */ + rdbCheckError("Cannot check RDB that is a FIFO: %s", argv[1]); + return; + } redis_check_rdb_main(2,argv,NULL); } else if (corruption_error) { /* In diskless loading, in case of corrupt file, log and exit. */ |