Repository navigation
S3Queue: keep inherited failed_files_ttl_sec in sync with tracked_file_ttl_sec until set explicitly - #125433
S3Queue: keep inherited failed_files_ttl_sec in sync with tracked_file_ttl_sec until set explicitly#125433adityaksolves wants to merge 24 commits into
Conversation
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.
…che reconciliation
…arker in waitForPathToBeProcessed
…ck in hash-ring path; fix retriable marker test helper
…r a cache-hot Failed file
…e_ttl_sec until set explicitly
|
Workflow [PR], commit [cee0ed9] Summary: ✅
AI ReviewSummaryThis PR persists Findings❌ Blockers
Tests
Final Verdict❌ Block. Preserve explicitly requested TTL assignments through the outer |
|
CI status at 31ad5cd: all S3Queue-related checks pass (Style check, Fast test, all asan/tsan/msan builds, Parser memory check, integration tests for ObjectStorageQueue). The remaining failures look unrelated to this change: |
…an explicit local setting
…t-out from a stale cache alterSettings built the new table metadata from the locally cached table_metadata, which can be stale. An unrelated ALTER on one replica could therefore write back an old failed_files_ttl_sec_inherited flag and undo an opt-out made on another replica. Start from the retention state read from Keeper under the alter lock, and make the same-value opt-out check use it as well. Add a two-replica regression test.
…ep the inherited failed TTL invariant
…eshed metadata in alterSettings The no-op check in alterSettings compared the requested value against the possibly stale local table_metadata. After the Keeper refresh of tracked_files_ttl_sec, a real change could be skipped, leaving Keeper with the old TTL and causing METADATA_MISMATCH on a later reattach. Compare against new_table_metadata instead, as the failed_files_ttl_sec branch already does, and extend the two-replica integration test to cover this case.
| /// Start from the retention state currently stored in Keeper so an unrelated ALTER does not revert it. | ||
| new_table_metadata.failed_files_ttl_sec = metadata_from_zk.failed_files_ttl_sec.load(); | ||
| new_table_metadata.failed_files_ttl_sec_inherited = metadata_from_zk.failed_files_ttl_sec_inherited.load(); | ||
| new_table_metadata.tracked_files_ttl_sec = metadata_from_zk.tracked_files_ttl_sec.load(); |
There was a problem hiding this comment.
[P1] Forward explicitly requested TTLs before filtering SQL no-ops
The Keeper refresh also needs a change in StorageObjectStorageQueue::alter: its filter at StorageObjectStorageQueue.cpp:1749–1752 drops a requested assignment when it equals the stored SQL setting, before alterSettings can compare it with Keeper.
For example, start two legacy replicas with tracked_file_ttl_sec=3600. Replica A sets it to 10; replica B then explicitly sets it back to 3600. B's SQL definition already contains 3600, so changed_settings is empty. This refresh retains Keeper's 10 and writes it back, although B's ALTER succeeds. Both effective TTLs remain 10, and detaching/attaching B raises METADATA_MISMATCH because its SQL definition still says 3600. The same filter prevents restoring failed_files_ttl_sec to a value already present in the local SQL definition.
Please forward TTL assignments explicitly present in the ALTER commands even when their SQL values are unchanged, and let the Keeper-based comparisons decide whether they are no-ops. Keep unrelated unchanged SQL settings filtered out. Extend the existing two-replica regression with the requested-value-equals-SQL case and assert the Keeper TTLs and successful reattach.
…ing them The waits before the two SELECTs required `count() >= 1` and `count() >= 11`, which only proves that one FileLog batch was committed. The second round appends lines 1..20 with separate writes, so a batch can start in the middle of the loop and read a prefix, with the rest arriving in the next batch. On `Stateless tests (arm_binary, s3 storage, DBReplicated, sequential)` the SELECT then ran between the part with 11..18 and the part with 19, 20, and printed 1..18 (PR ClickHouse#125135) or 1..19 (PR ClickHouse#125433). Wait for every row the following SELECT prints instead (10 and 20). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #113054
Depends on #121752 (the diff below also shows #121752's commits until it is merged; the only new commit here is 31ad5cd).
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
S3Queue: keep the inherited failed-files TTL for legacy tables in sync with later
tracked_file_ttl_secchanges untilfailed_files_ttl_secis set explicitly.Detailed Description
This is Phase 2, PR 1 of splitting #113784. It is the "inherited flag" item that was deferred from #121752.
Problem: for a legacy table (no
failed_files_ttl_seckey in Keeper metadata),failed_files_ttl_secis copied fromtracked_file_ttl_secon attach.toString()then wrote this copied value to Keeper as if it were explicit, so a laterALTER TABLE ... MODIFY SETTING tracked_file_ttl_sec = Nleft the failed TTL stuck on the old value (see the AI review finding atObjectStorageQueueTableMetadata.cpp:118on #121752).Fix: a new
failed_files_ttl_sec_inheritedflag in the table metadata.true.true: alteringtracked_file_ttl_secalso updatesfailed_files_ttl_sec.failed_files_ttl_secexplicitly: flag becomesfalse.failed_files_ttl_secset explicitly: flag isfalse.Also updates the setting description and the docs note in
registerQueueStorage.cpp.Tests (
test_failed_files_ttl.py):test_legacy_inherited_failed_files_ttl_follows_tracked_ttl_altertest_explicit_failed_files_ttl_ignores_tracked_ttl_alterNot in this PR
Stale
.retriablecleanup and the in-flight retry race (#125565), exclusive mode failure terminality and liveloading_retrieshandling (#125604), ordered mode support, and theLIKE 'prefix/%'filter inSYSTEM DROP. These come in separate follow-up PRs.Workflow [PR]
Sync PR [sync-upstream/pr/125433]