Skip to content

Conversation

@guilload
Copy link
Member

Description

This test always succeeds when run in isolation but is flaky when multiple tests are executed simultaneously because the pattern insert with CTE followed by SELECT ... is not atomic. Here's Gemini explanation:

This error is a classic example of a PostgreSQL race condition involving Common Table Expressions (CTEs) and visibility. While it looks like the query should be atomic, the WITH clause and the SELECT statement don't necessarily see the results of each other the way you'd expect if another process is interacting with the database at the exact same millisecond.

How was this PR tested?

Ran this multiple times: QW_TEST_DATABASE_URL=postgres://[...] c t --manifest-path quickwit/Cargo.toml -p quickwit-metastore --all-features --

@guilload guilload linked an issue Dec 26, 2025 that may be closed by this pull request
@guilload guilload added this to the Fix flaky tests milestone Dec 26, 2025
",
INSERT INTO kv (key, value)
VALUES ('cluster_identity', $1)
ON CONFLICT (key) DO UPDATE SET key = EXCLUDED.key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

til about the virtual EXCLUDED table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test in quickwit-metastore crate

3 participants