Skip to content

S3Queue: allow altering tracked_files_limit in ordered mode and fix exclusive-mode failure terminality - #125604

Open
adityaksolves wants to merge 24 commits into
ClickHouse:masterfrom
adityaksolves:feature/s3queue-ordered-tracked-files-limit-alterable
Open

adityaksolves wants to merge 24 commits into
ClickHouse:masterfrom
adityaksolves:feature/s3queue-ordered-tracked-files-limit-alterable

Conversation

@adityaksolves

@adityaksolves adityaksolves commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #113054
Depends on #121752 (the diff also shows #121752's commits until it is merged; the new commits here are 3433f8c and 0aa9aa1).

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

S3Queue: tracked_files_limit can now be changed with ALTER TABLE ... MODIFY SETTING for tables in ordered mode. Also fixed SYSTEM FLUSH OBJECT STORAGE QUEUE in exclusive mode aborting on the first retryable failure.

Detailed description

This is a Phase 2 follow-up from the split of #113784.

Problem: since #121752, tracked_files_limit also caps the /failed set in ordered mode, but it was missing from changeable_settings_ordered_mode, so ALTER TABLE ... MODIFY SETTING tracked_files_limit = N was rejected for ordered tables (Changing setting tracked_files_limit is not allowed for ORDERED mode).

Fix: add tracked_files_limit to changeable_settings_ordered_mode. The ALTER handler in ObjectStorageQueueMetadata is not mode-specific, so no other change is needed.

Second fix in this PR (exclusive mode): ObjectStorageQueueExclusiveFileMetadata::getPathState() hard-coded is_terminal_out = true for every Failed state, while the claim path (setProcessingImpl(), prepareFailedRequestsImpl()) treats a failure as retryable until retries reaches max_loading_retries. So waitForPathToBeProcessed() could throw ABORTED on the first retryable exclusive failure. getPathState() now reports a failure as terminal only when the retry budget is exhausted, mirroring the claim check.

This is the exclusive-mode getPathState() item that was deferred from #121752 (see the scope discussion in #113784). A regression test for it is intentionally left for a follow-up, as agreed there, because tests that wait across a retryable failure are timing-dependent.

Test: test_ordered_mode_tracked_files_limit_is_alterable (test_failed_files_ttl.py) alters the setting on an ordered table and checks the value in the Keeper metadata.

Verification status: the ordered-mode test fails without the fix with the expected error. It has not yet been verified green with the fix; CI results are pending. The test does not cover multi-replica behavior or the cleanup sweep after lowering the limit. The exclusive-mode change is C++ only, not compiled or run locally; CI results are pending.

Not in this PR

LIKE 'prefix/%' filter in SYSTEM DROP, a regression test for the exclusive-mode change, and ordered mode support for failed_files_ttl_sec.


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

Adds the failed_files_ttl_sec engine setting, which controls time-based
expiry of terminal failed files in unordered mode. tracked_files_limit's
description is also updated to document that it caps the failed-files
set by count in both ordered and unordered mode, independently of the
new setting.

For tables created before this setting existed, the value is inherited
from tracked_file_ttl_sec at attach time; this inheritance is a one-time
fallback and is not kept in sync with later changes to tracked_file_ttl_sec.
…ck in hash-ring path; fix retriable marker test helper
tracked_files_limit also caps the /failed set in ordered mode, but was missing from changeable_settings_ordered_mode, so ALTER ... MODIFY SETTING was rejected. Add it to the list and cover with an integration test.
…ries are exhausted

getPathState() hard-coded is_terminal_out = true for every Failed state, while the claim path (setProcessingImpl, prepareFailedRequestsImpl) treats a failure as retryable until retries reach max_loading_retries. As a result waitForPathToBeProcessed() could throw ABORTED on the first retryable exclusive failure. Mirror the claim check instead.
@adityaksolves adityaksolves changed the title S3Queue: allow altering tracked_files_limit in ordered mode S3Queue: allow altering tracked_files_limit in ordered mode and fix exclusive-mode failure terminality Oct 13, 2026
@adityaksolves

Copy link
Copy Markdown
Contributor Author

I folded the exclusive-mode getPathState() fix (deferred from #121752) into this PR, since both changes are small mode-specific fixes. Happy to split it into a separate PR if you prefer. Also, could the Phase 2 PRs (#125392, #125433, #125565, #125604) get the can be tested label so CI can run? Thanks!

@clickhouse-gh clickhouse-gh Bot added the external Author is not a member of the ClickHouse organization label Oct 14, 2026
@nihalzp nihalzp added the can be tested Allows running workflows for external contributors label Oct 14, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [cf056da]

Summary: ❌

job_name test_name status info comment
AST fuzzer (amd_debug, targeted, old_compatibility) ERROR
OOM in dmesg ERROR cidb

AI Review

Summary

Reviewed cf056dad269a5a7f7fb84e833c74c7fdc6356da3, the complete stacked diff, current implementations, tests, and all discussion on PR #125604. The ordered-mode tracked_files_limit alteration and exclusive-mode retry comparisons are wired through the relevant paths; the previously reported frozen retry-limit comparisons are fixed. One new compatibility regression remains, along with the still-present findings deferred by the author to related work. Verdict: ❌ Block.

Missing context / blind spots
  • ⚠️ The Praktika report is green and reports no failed tests, but the fetched integration reports contain no individual test results. The specific new integration cases therefore could not be confirmed from those reports. No local build, integration run, or performance benchmark was performed; focused executions of the cases below would close that evidence gap.
  • ⚠️ Exclusive-mode regression coverage is deliberately deferred in the PR description and prior maintainer discussion. The implementation now consistently reads the live retry limit, but runtime behavior across a retryable exclusive failure remains unverified here.
Findings

❌ Blockers

⚠️ Majors

Tests
  • ⚠️ Add an upgrade/attach regression for an ordered table whose Keeper metadata lacks failed_files_ttl_sec, with tracked_file_ttl_sec > 0, one terminal failure below the count cap, and a filename ahead of the watermark. Correct the object and verify that expiry permits successful ingestion.
  • ⚠️ For the deferred failure transitions, exercise an already-owned retry during limit lowering, and a first failure racing a positive-to-zero change. Verify Keeper state and committed rows, rather than only the local cache.
  • ⚠️ Measure claim batching with enable_hash_ring_filtering = 1 and cache expiry with a populated cache to quantify the two identified cost increases.
Final Verdict

❌ Block. Preserve existing ordered-table TTL behavior and cover it with the focused regression. The deferred correctness issues also remain in the full current diff; reconcile the dependency and sibling fixes before merging that combined implementation. Existing dismissed threads were left unchanged, and only the new compatibility finding was submitted inline.

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Oct 14, 2026

This branch has not been deployed

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

Labels

can be tested Allows running workflows for external contributors comp-s3queue S3Queue/AzureQueue engines (queue-based ingestion from object storage). external Author is not a member of the ClickHouse organization pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants