Skip to content

test(sql): fix flaky testQueryTimeout() due to WAL apply race condition#5790

Merged
bluestreak01 merged 2 commits intomasterfrom
jh_flaky_timeout_test
Jun 27, 2025
Merged

test(sql): fix flaky testQueryTimeout() due to WAL apply race condition#5790
bluestreak01 merged 2 commits intomasterfrom
jh_flaky_timeout_test

Conversation

@jerrinot
Copy link
Copy Markdown
Contributor

@jerrinot jerrinot commented Jun 27, 2025

The test assumes that drainWalQueue() guarantees the WAL is fully applied when it returns. However, this assumption only holds when there's no background WAL apply job running.

When a background job exists, it competes with drainWalQueue() to process the queue. This creates a race condition where:

  1. The background job dequeues and begins applying a WAL entry
  2. drainWalQueue() sees an empty queue and returns
  3. The test's query assertion runs before the background job completes
  4. The assertion fails because it sees the table in a pre-WAL state

The test assumes that drainWalQueue() guarantees the WAL is fully applied
when it returns. However, this assumption only holds when there's no
background WAL apply job running.

When a background job exists, it competes with drainWalQueue() to process
the queue. This creates a race condition where:
1. The background job dequeues and begins applying a WAL entry
2. drainWalQueue() sees an empty queue and returns
3. The test's query assertion runs before the background job completes
4. The assertion fails because it sees the table in a pre-WAL state
@jerrinot jerrinot added the Flaky Test Depicts a test that breaks due to race condition or wrong assumption label Jun 27, 2025
mtopolnik
mtopolnik previously approved these changes Jun 27, 2025
clippy was moaning on the latest Rust toolchain (1.88.0)
@glasstiger
Copy link
Copy Markdown
Contributor

[PR Coverage check]

😍 pass : 0 / 0 (0%)

@bluestreak01 bluestreak01 merged commit 8107206 into master Jun 27, 2025
37 checks passed
@bluestreak01 bluestreak01 deleted the jh_flaky_timeout_test branch June 27, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Flaky Test Depicts a test that breaks due to race condition or wrong assumption

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants