Skip to content

Fix flaky queue-log assertions in test_storage_s3_queue - #117954

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-s3queue-log-flush-race
Sep 4, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-s3queue-log-flush-race

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Related: #117066
Related: #116992

test_delete_after_processing, test_tag_after_processing and test_move_after_processing in tests/integration/test_storage_s3_queue/test_0.py wait for the destination materialized view table to reach its final row count, then issue a single SYSTEM FLUSH LOGS and assert on system.s3queue_log / system.azure_queue_log and the corresponding metadata cache.

That is racy: ObjectStorageQueueSource::appendLogElement is called from finalizeCommit, that is, only after the rows have already been committed to the materialized view target. The destination row count reaching its expected value therefore does not imply that the log entry has been queued yet, and the flush can flush nothing, after which the assertion reads 0 instead of files_num * row_num.

Replace the one-shot flush and assert with a wait_for_queue_log_rows helper that flushes and polls until the expected counts are reported, in the same shape as wait_for_object_counts added in #117066 for the object-count race in the very same tests.

Observed on #116992, job Integration tests (arm_binary, distributed plan, 4/4): test_move_after_processing[another_bucket-AzureQueue] failed with assert 0 == (5 * 10) on SELECT sum(rows_processed) FROM system.azure_queue_log. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116992&sha=89a75069566f416b4e13ff62db0732bc1ce1545e&name_0=PR&name_1=Integration%20tests%20(arm_binary,%20distributed%20plan,%204/4)

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/117954]

Version info

  • Merged into: 26.9.1.726 (included in 26.9 and later)

`test_delete_after_processing`, `test_tag_after_processing` and `test_move_after_processing`
wait for the destination materialized view table to reach its final row count, then issue a
single `SYSTEM FLUSH LOGS` and assert on `system.s3queue_log` / `system.azure_queue_log`
and the corresponding metadata cache.

That is racy: `ObjectStorageQueueSource::appendLogElement` is called from `finalizeCommit`,
after the rows have already been committed to the materialized view target, so the log entry
may not have been queued yet when the flush happens, and the flush then flushes nothing.
The assertion then sees `0` instead of `files_num * row_num`.

Replace the one-shot flush and assert with `wait_for_queue_log_rows`, which flushes and polls
until the expected counts are reported, in the same shape as `wait_for_object_counts` added in
#117066 for the object-count race in the same tests.

Observed on #116992 in
`Integration tests (arm_binary, distributed plan, 4/4)`:
`test_move_after_processing[another_bucket-AzureQueue]` failed with
`assert 0 == (5 * 10)` on `SELECT sum(rows_processed) FROM system.azure_queue_log`.
@clickhouse-gh

clickhouse-gh Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [987c0b9]

Summary: ✅


AI Review

Summary

The PR replaces one-shot queue-log assertions in three test_storage_s3_queue integration tests with a polling helper that repeatedly flushes system logs until system.s3queue_log / system.azure_queue_log and the matching metadata cache report the expected rows_processed. I did not find a correctness or coverage regression in the current patch.

Missing context / blind spots
  • ⚠️ I did not rerun the affected integration tests locally, and the PR CI is still in progress. A green run of the touched test_storage_s3_queue jobs would close the remaining evidence gap that this removes the observed flake on both S3Queue and AzureQueue.
Final Verdict

No new review findings.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Sep 3, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

LGTM

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 4, 2026
@alexey-milovidov alexey-milovidov self-assigned this Sep 4, 2026
Merged via the queue into master with commit 3893712 Sep 4, 2026
174 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-s3queue-log-flush-race branch September 4, 2026 22:15
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 4, 2026
@clickhouse-gh clickhouse-gh Bot added comp-s3queue S3Queue/AzureQueue engines (queue-based ingestion from object storage). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-s3queue S3Queue/AzureQueue engines (queue-based ingestion from object storage). pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants