Skip to content

Commit

Permalink
fix: redis check aof -> valkey check aof
Browse files Browse the repository at this point in the history
Signed-off-by: Anuragkillswitch <[email protected]>
  • Loading branch information
SoulPancake committed May 29, 2024
1 parent a462fe1 commit f7d0c13
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -7152,7 +7152,7 @@ int main(int argc, char **argv) {
#ifdef USE_REDIS_SYMLINKS
if (strstr(exec_name,"redis-check-rdb") != NULL)
redis_check_rdb_main(argc, argv, NULL);
else if (strstr(exec_name,"redis-check-aof") != NULL)
else if (strstr(exec_name,"valkey-check-aof") != NULL)
redis_check_aof_main(argc,argv);
#endif

Expand Down
50 changes: 25 additions & 25 deletions tests/integration/aof.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ tags {"aof external:skip"} {
}
}

## Test that redis-check-aof indeed sees this AOF is not valid
## Test that valkey-check-aof indeed sees this AOF is not valid
test "Short read: Utility should confirm the AOF is not valid" {
catch {
exec src/redis-check-aof $aof_manifest_file
exec src/valkey-check-aof $aof_manifest_file
} result
assert_match "*not valid*" $result
}
Expand All @@ -119,13 +119,13 @@ tags {"aof external:skip"} {
}

catch {
exec src/redis-check-aof $aof_manifest_file
exec src/valkey-check-aof $aof_manifest_file
} result
assert_match "*ok_up_to_line=8*" $result
}

test "Short read: Utility should be able to fix the AOF" {
set result [exec src/redis-check-aof --fix $aof_manifest_file << "y\n"]
set result [exec src/valkey-check-aof --fix $aof_manifest_file << "y\n"]
assert_match "*Successfully truncated AOF*" $result
}

Expand Down Expand Up @@ -397,7 +397,7 @@ tags {"aof external:skip"} {

test {Truncate AOF to specific timestamp} {
# truncate to timestamp 1628217473
exec src/redis-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file
exec src/valkey-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file
start_server_aof [list dir $server_path] {
set c [redis [srv host] [srv port] 0 $::tls]
wait_done_loading $c
Expand All @@ -407,7 +407,7 @@ tags {"aof external:skip"} {
}

# truncate to timestamp 1628217471
exec src/redis-check-aof --truncate-to-timestamp 1628217471 $aof_manifest_file
exec src/valkey-check-aof --truncate-to-timestamp 1628217471 $aof_manifest_file
start_server_aof [list dir $server_path] {
set c [redis [srv host] [srv port] 0 $::tls]
wait_done_loading $c
Expand All @@ -417,7 +417,7 @@ tags {"aof external:skip"} {
}

# truncate to timestamp 1628217470
exec src/redis-check-aof --truncate-to-timestamp 1628217470 $aof_manifest_file
exec src/valkey-check-aof --truncate-to-timestamp 1628217470 $aof_manifest_file
start_server_aof [list dir $server_path] {
set c [redis [srv host] [srv port] 0 $::tls]
wait_done_loading $c
Expand All @@ -426,7 +426,7 @@ tags {"aof external:skip"} {
}

# truncate to timestamp 1628217469
catch {exec src/redis-check-aof --truncate-to-timestamp 1628217469 $aof_manifest_file} e
catch {exec src/valkey-check-aof --truncate-to-timestamp 1628217469 $aof_manifest_file} e
assert_match {*aborting*} $e
}

Expand Down Expand Up @@ -469,38 +469,38 @@ tags {"aof external:skip"} {
}
}

test {Test redis-check-aof for old style resp AOF} {
test {Test valkey-check-aof for old style resp AOF} {
create_aof $aof_dirpath $aof_file {
append_to_aof [formatCommand set foo hello]
append_to_aof [formatCommand set bar world]
}

catch {
exec src/redis-check-aof $aof_file
exec src/valkey-check-aof $aof_file
} result
assert_match "*Start checking Old-Style AOF*is valid*" $result
}

test {Test redis-check-aof for old style resp AOF - has data in the same format as manifest} {
test {Test valkey-check-aof for old style resp AOF - has data in the same format as manifest} {
create_aof $aof_dirpath $aof_file {
append_to_aof [formatCommand set file file]
append_to_aof [formatCommand set "file appendonly.aof.2.base.rdb seq 2 type b" "file appendonly.aof.2.base.rdb seq 2 type b"]
}

catch {
exec src/redis-check-aof $aof_file
exec src/valkey-check-aof $aof_file
} result
assert_match "*Start checking Old-Style AOF*is valid*" $result
}

test {Test redis-check-aof for old style rdb-preamble AOF} {
test {Test valkey-check-aof for old style rdb-preamble AOF} {
catch {
exec src/redis-check-aof tests/assets/rdb-preamble.aof
exec src/valkey-check-aof tests/assets/rdb-preamble.aof
} result
assert_match "*Start checking Old-Style AOF*RDB preamble is OK, proceeding with AOF tail*is valid*" $result
}

test {Test redis-check-aof for Multi Part AOF with resp AOF base} {
test {Test valkey-check-aof for Multi Part AOF with resp AOF base} {
create_aof $aof_dirpath $aof_base_file {
append_to_aof [formatCommand set foo hello]
append_to_aof [formatCommand set bar world]
Expand All @@ -517,12 +517,12 @@ tags {"aof external:skip"} {
}

catch {
exec src/redis-check-aof $aof_manifest_file
exec src/valkey-check-aof $aof_manifest_file
} result
assert_match "*Start checking Multi Part AOF*Start to check BASE AOF (RESP format)*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 with rdb-preamble AOF base} {
test {Test valkey-check-aof for Multi Part AOF with rdb-preamble AOF base} {
exec cp tests/assets/rdb-preamble.aof $aof_base_file

create_aof $aof_dirpath $aof_file {
Expand All @@ -536,25 +536,25 @@ tags {"aof external:skip"} {
}

catch {
exec src/redis-check-aof $aof_manifest_file
exec src/valkey-check-aof $aof_manifest_file
} result
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} {
test {Test valkey-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
exec src/valkey-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} {
test {Test valkey-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]
append_to_aof [formatCommand multi]
Expand All @@ -572,17 +572,17 @@ tags {"aof external:skip"} {
}

catch {
exec src/redis-check-aof $aof_manifest_file
exec src/valkey-check-aof $aof_manifest_file
} result
assert_match "*not valid*" $result

catch {
exec src/redis-check-aof --fix $aof_manifest_file
exec src/valkey-check-aof --fix $aof_manifest_file
} result
assert_match "*Failed to truncate AOF*because it is not the last file*" $result
}

test {Test redis-check-aof only truncates the last file for Multi Part AOF in truncate-to-timestamp mode} {
test {Test valkey-check-aof only truncates the last file for Multi Part AOF in truncate-to-timestamp mode} {
create_aof $aof_dirpath $aof_base_file {
append_to_aof "#TS:1628217470\r\n"
append_to_aof [formatCommand set foo1 bar1]
Expand All @@ -605,7 +605,7 @@ tags {"aof external:skip"} {
}

catch {
exec src/redis-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file
exec src/valkey-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file
} result
assert_match "*Failed to truncate AOF*to timestamp*because it is not the last file*" $result
}
Expand Down

0 comments on commit f7d0c13

Please sign in to comment.