Unverified Commit 3f3f678a authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

corrupt-dump-fuzzer test, avoid creating junk keys (#9302)

The execution of the RPOPLPUSH command by the fuzzer created junk keys,
that were later being selected by RANDOMKEY and modified.
This also meant that lists were statistically tested more than other
files.

Fix the fuzzer not to pass junk key names to RPOPLPUSH, and add a check
that detects that new keys are not added by the fuzzer to detect future
similar issues.
parent 0c90370e
...@@ -99,6 +99,7 @@ foreach sanitize_dump {no yes} { ...@@ -99,6 +99,7 @@ foreach sanitize_dump {no yes} {
r debug set-skip-checksum-validation 1 r debug set-skip-checksum-validation 1
set start_time [clock seconds] set start_time [clock seconds]
generate_types generate_types
set dbsize [r dbsize]
r save r save
set cycle 0 set cycle 0
set stat_terminated_in_restore 0 set stat_terminated_in_restore 0
...@@ -142,6 +143,12 @@ foreach sanitize_dump {no yes} { ...@@ -142,6 +143,12 @@ foreach sanitize_dump {no yes} {
set sent [generate_fuzzy_traffic_on_key "_$k" 1] ;# traffic for 1 second set sent [generate_fuzzy_traffic_on_key "_$k" 1] ;# traffic for 1 second
incr stat_traffic_commands_sent [llength $sent] incr stat_traffic_commands_sent [llength $sent]
r del "_$k" ;# in case the server terminated, here's where we'll detect it. r del "_$k" ;# in case the server terminated, here's where we'll detect it.
if {$dbsize != [r dbsize]} {
puts "unexpected keys"
puts "keys: [r keys *]"
puts $sent
exit 1
}
} err ] } { } err ] } {
# if the server terminated update stats and restart it # if the server terminated update stats and restart it
set report_and_restart true set report_and_restart true
......
...@@ -623,6 +623,7 @@ proc generate_fuzzy_traffic_on_key {key duration} { ...@@ -623,6 +623,7 @@ proc generate_fuzzy_traffic_on_key {key duration} {
set arity [lindex $cmd_info 1] set arity [lindex $cmd_info 1]
set arity [expr $arity < 0 ? - $arity: $arity] set arity [expr $arity < 0 ? - $arity: $arity]
set firstkey [lindex $cmd_info 3] set firstkey [lindex $cmd_info 3]
set lastkey [lindex $cmd_info 4]
set i 1 set i 1
if {$cmd == "XINFO"} { if {$cmd == "XINFO"} {
lappend cmd "STREAM" lappend cmd "STREAM"
...@@ -652,7 +653,7 @@ proc generate_fuzzy_traffic_on_key {key duration} { ...@@ -652,7 +653,7 @@ proc generate_fuzzy_traffic_on_key {key duration} {
incr i 4 incr i 4
} }
for {} {$i < $arity} {incr i} { for {} {$i < $arity} {incr i} {
if {$i == $firstkey} { if {$i == $firstkey || $i == $lastkey} {
lappend cmd $key lappend cmd $key
} else { } else {
lappend cmd [randomValue] lappend cmd [randomValue]
......
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