Unverified Commit 71fbe6e8 authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

Fix leak in new errorstats commit, and a flaky test (#8278)

parent 152b5d46
...@@ -3301,7 +3301,7 @@ void resetCommandTableStats(void) { ...@@ -3301,7 +3301,7 @@ void resetCommandTableStats(void) {
} }
void resetErrorTableStats(void) { void resetErrorTableStats(void) {
raxFree(server.errors); raxFreeWithCallback(server.errors, zfree);
server.errors = raxNew(); server.errors = raxNew();
} }
......
...@@ -26,11 +26,20 @@ test "errorstats: rejected call due to MOVED Redirection" { ...@@ -26,11 +26,20 @@ test "errorstats: rejected call due to MOVED Redirection" {
$primary2 config resetstat $primary2 config resetstat
assert_match {} [errorstat $primary1 MOVED] assert_match {} [errorstat $primary1 MOVED]
assert_match {} [errorstat $primary2 MOVED] assert_match {} [errorstat $primary2 MOVED]
# we know that the primary 2 will have a MOVED reply # we know that one will have a MOVED reply and one will succeed
catch {$primary1 set key{0x0000} b} replyP1 catch {$primary1 set key b} replyP1
catch {$primary2 set key{0x0000} b} replyP2 catch {$primary2 set key b} replyP2
assert_match {OK} $replyP1 # sort servers so we know which one failed
assert_match {} [errorstat $primary1 MOVED] if {$replyP1 eq {OK}} {
assert_match {*count=1*} [errorstat $primary2 MOVED] assert_match {MOVED*} $replyP2
assert_match {*calls=0,*,rejected_calls=1,failed_calls=0} [cmdstat $primary2 set] set pok $primary1
set perr $primary2
} else {
assert_match {MOVED*} $replyP1
set pok $primary2
set perr $primary1
}
assert_match {} [errorstat $pok MOVED]
assert_match {*count=1*} [errorstat $perr MOVED]
assert_match {*calls=0,*,rejected_calls=1,failed_calls=0} [cmdstat $perr set]
} }
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