Skip to content

Fix flaky ClickHouse test: add FINAL to metadata query#1204

Closed
BilalG1 wants to merge 1 commit into
devfrom
clickhouse-flaky-fix-3
Closed

Fix flaky ClickHouse test: add FINAL to metadata query#1204
BilalG1 wants to merge 1 commit into
devfrom
clickhouse-flaky-fix-3

Conversation

@BilalG1
Copy link
Copy Markdown
Collaborator

@BilalG1 BilalG1 commented Feb 16, 2026

Summary

  • Add FINAL keyword to the getClickhouseLastSyncedSequenceId query against the _stack_sync_metadata table

Theory

_stack_sync_metadata is a ReplacingMergeTree(updated_at) table. Without the FINAL keyword, unmerged rows can cause ORDER BY updated_at DESC LIMIT 1 to return a stale high value, causing the sync engine to skip data. This could make the test wait forever for data that was already "synced" according to a stale metadata row.

Test plan

  • CI should pass on this branch
  • The "Updates to user are synced to ClickHouse" test should stop intermittently timing out

The _stack_sync_metadata table uses ReplacingMergeTree(updated_at).
Without the FINAL keyword, unmerged rows can cause the query to
return a stale high value via ORDER BY updated_at DESC LIMIT 1,
causing the sync engine to skip data.

Add FINAL to ensure ClickHouse deduplicates rows before returning
the last_synced_sequence_id.
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-backend Ready Ready Preview, Comment Feb 16, 2026 8:31pm
stack-dashboard Ready Ready Preview, Comment Feb 16, 2026 8:31pm
stack-demo Ready Ready Preview, Comment Feb 16, 2026 8:31pm
stack-docs Ready Ready Preview, Comment Feb 16, 2026 8:31pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 16, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clickhouse-flaky-fix-3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BilalG1 BilalG1 closed this Feb 16, 2026
@BilalG1 BilalG1 deleted the clickhouse-flaky-fix-3 branch February 16, 2026 20:51
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.

1 participant