Skip to content

Commit 6a5fee6

Browse files
authored
Fix flaky XREADGROUP BLOCK CLAIM tests (#16119)
**Summary** Two `stream-cgroups.tcl` tests block with `CLAIM 1000` and expect XNACK or XADD to wake the client before the entries become claimable by idle time. If the command arrives about 1 s late (a slow runner, or a helper that sleeps instead of polling), the idle claim wins and the test fails. This is a test-only change. **Changes** Raise the CLAIM threshold in both tests (`tests/unit/type/stream-cgroups.tcl`) `BLOCK 5000 CLAIM 1000` is now `BLOCK 20000 CLAIM 10000`, so only XNACK or XADD can wake the client. The XNACK test now also fails if XNACK stops waking the client; before, the idle timer hid that. Tighten the new-message test (`tests/unit/type/stream-cgroups.tcl`) It now asserts that the returned entry is `2-0`. The `# comment` after `after 100` is removed: Tcl treated it as arguments, so the sleep never ran.
1 parent 4188839 commit 6a5fee6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎tests/unit/type/stream-cgroups.tcl‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,18 +3044,19 @@ start_server {
30443044
r XREADGROUP GROUP group1 consumer1 STREAMS mystream >
30453045

30463046
set rd [redis_deferring_client]
3047-
$rd XREADGROUP GROUP group1 consumer2 BLOCK 5000 CLAIM 1000 STREAMS mystream >
3047+
$rd XREADGROUP GROUP group1 consumer2 BLOCK 20000 CLAIM 10000 STREAMS mystream >
30483048

30493049
wait_for_blocked_client
30503050

3051-
after 100 # Before min-idle-time
3051+
after 100 ;# Before min-idle-time
30523052
r XADD mystream 2-0 f v2
30533053

30543054
set result [$rd read]
30553055

30563056
# Unblock with new message immediately, not wait for CLAIM threshold
30573057
lassign [lindex $result 0] stream_name messages
30583058
assert_equal [llength $messages] 1
3059+
assert_equal [lindex $messages 0 0] 2-0
30593060

30603061
$rd close
30613062
}
@@ -4148,9 +4149,9 @@ start_server {
41484149
r XGROUP CREATE mystream grp 0
41494150
r XREADGROUP GROUP grp c1 STREAMS mystream >
41504151

4151-
# c2 blocks waiting for claimable entries with min-idle 1000ms
4152+
# c2 blocks waiting for claimable entries with min-idle 10000ms
41524153
set rd [redis_deferring_client]
4153-
$rd XREADGROUP GROUP grp c2 BLOCK 5000 CLAIM 1000 STREAMS mystream >
4154+
$rd XREADGROUP GROUP grp c2 BLOCK 20000 CLAIM 10000 STREAMS mystream >
41544155
wait_for_blocked_client
41554156

41564157
# XNACK makes entries immediately claimable, waking c2

0 commit comments

Comments
 (0)