Removed time sensitive checks from block on background tests. Fixed uninitialized variable (#8479)

- removes time sensitive checks from block on background tests during leak checks.
- fix uninitialized variable on RedisModuleBlockedClient() when calling
  RM_BlockedClientMeasureTimeEnd() without RM_BlockedClientMeasureTimeStart()
This commit is contained in:
filipe oliveira
2021-02-10 08:59:07 +02:00
committed by GitHub
parent 899c85ae67
commit b5ca1e9e53
4 changed files with 40 additions and 19 deletions
+33 -12
View File
@@ -8,12 +8,18 @@ start_server {tags {"modules"}} {
test { blocked clients time tracking - check blocked command that uses RedisModule_BlockedClientMeasureTimeStart() is tracking background time} {
r slowlog reset
r config set slowlog-log-slower-than 200000
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
r block.debug 0 10000
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
r config resetstat
r block.debug 200 10000
assert_equal [r slowlog len] 1
if {!$::no_latency} {
assert_equal [r slowlog len] 1
}
set cmdstatline [cmdrstat block.debug r]
@@ -25,12 +31,18 @@ start_server {tags {"modules"}} {
test { blocked clients time tracking - check blocked command that uses RedisModule_BlockedClientMeasureTimeStart() is tracking background time even in timeout } {
r slowlog reset
r config set slowlog-log-slower-than 200000
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
r block.debug 0 20000
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
r config resetstat
r block.debug 20000 500
assert_equal [r slowlog len] 1
if {!$::no_latency} {
assert_equal [r slowlog len] 1
}
set cmdstatline [cmdrstat block.debug r]
@@ -42,13 +54,18 @@ start_server {tags {"modules"}} {
test { blocked clients time tracking - check blocked command with multiple calls RedisModule_BlockedClientMeasureTimeStart() is tracking the total background time } {
r slowlog reset
r config set slowlog-log-slower-than 200000
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
r block.double_debug 0
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
r config resetstat
r block.double_debug 100
assert_equal [r slowlog len] 1
if {!$::no_latency} {
assert_equal [r slowlog len] 1
}
set cmdstatline [cmdrstat block.double_debug r]
regexp "calls=1,usec=(.*?),usec_per_call=(.*?),rejected_calls=0,failed_calls=0" $cmdstatline usec usec_per_call
@@ -59,9 +76,13 @@ start_server {tags {"modules"}} {
test { blocked clients time tracking - check blocked command without calling RedisModule_BlockedClientMeasureTimeStart() is not reporting background time } {
r slowlog reset
r config set slowlog-log-slower-than 200000
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
r block.debug_no_track 200 1000
# ensure slowlog is still empty
assert_equal [r slowlog len] 0
if {!$::no_latency} {
assert_equal [r slowlog len] 0
}
}
}