Skip to content

Commit

Permalink
code review: no need to reset is_manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-binbin committed Jan 18, 2024
1 parent 3360b0d commit 4b3dcbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/redis-check-aof.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,12 @@ int fileIsManifest(char *filepath) {

/* We will skip comments lines.
* At present, the manifest format is fixed, see aofInfoFormat.
* We will be returned directly as long as it encounters other items. */
* We will break directly as long as it encounters other items. */
if (buf[0] == '#') {
continue;
} else if (!memcmp(buf, "file", strlen("file"))) {
is_manifest = 1;
} else {
is_manifest = 0;
break;
}
}
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/aof.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,19 @@ tags {"aof external:skip"} {
assert_match "*Start checking Multi Part AOF*Start to check BASE AOF (RDB format)*DB preamble is OK, proceeding with AOF tail*BASE AOF*is valid*Start to check INCR files*INCR AOF*is valid*All AOF files and manifest are valid*" $result
}

test {Test redis-check-aof for Multi Part AOF contains a format error} {
create_aof_manifest $aof_dirpath $aof_manifest_file {
append_to_manifest "file appendonly.aof.1.base.aof seq 1 type b\n"
append_to_manifest "file appendonly.aof.1.incr.aof seq 1 type i\n"
append_to_manifest "!!!\n"
}

catch {
exec src/redis-check-aof $aof_manifest_file
} result
assert_match "*Invalid AOF manifest file format*" $result
}

test {Test redis-check-aof only truncates the last file for Multi Part AOF in fix mode} {
create_aof $aof_dirpath $aof_base_file {
append_to_aof [formatCommand set foo hello]
Expand Down

0 comments on commit 4b3dcbe

Please sign in to comment.