Repository navigation
S3Queue: add SYSTEM DROP S3QUEUE FAILED FILES command - #125392
adityaksolves wants to merge 36 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
|
Workflow [PR], commit [f46a2a0] Summary: ✅
AI ReviewSummaryThis PR adds Missing context / blind spots
Findings❌ Blockers
Tests
Final Verdict❌ Block. Minimum actions: protect active processing ownership during terminalization, preserve legacy ordered failure expiry, make cross-replica recovery honor Keeper's retry state, and handle shared-path cluster cleanup contention. Integrate the deferred dependency fixes before relying on their behavior, and close the focused regression and performance evidence gaps above. |
|
My agent is worried about an RBAC issue: "dropS3QueueFailedFiles has no access check for local execution (only the ON CLUSTER path checks, and with the broad SYSTEM_FLUSH). Please add context->checkAccess(AccessType::SYSTEM_FLUSH_OBJECT_STORAGE_QUEUE, table_id) as in flushObjectStorageQueue, use the same type in getRequiredAccessForDDLOnCluster, and add a negative test for a user without the grant. |
…access check for SYSTEM DROP S3QUEUE FAILED FILES
…d preserve explicit empty LIKE pattern
… SYSTEM DROP S3QUEUE FAILED FILES
|
@kssenii @george-larionov Config Workflow is failing on both of the last two runs (14:52 and 14:58 UTC+5:30) in the Check CI DB step with Connection refused to play.clickhouse.com:443, so all other jobs are DROPPED. This looks like a CI infrastructure issue rather than a code issue. Could you please re-run the workflow (or check CIDB)? Latest commit: 4f894b1 (functional change is e948e86). |
…ries are exhausted
dropFailedFiles runs from the query thread and talks to Keeper without a Coordination component set, which hits the 'Current component is empty' logical error in debug/sanitizer builds. Set the component guard in both StorageObjectStorageQueue::dropFailedFiles and ObjectStorageQueueMetadata::dropFailedFiles, as the other ObjectStorageQueue Keeper entry points do.
| return std::nullopt; | ||
| } | ||
| /// Keeper's live retry count is under the current limit: allow processing | ||
| /// to proceed below (covers e.g. a cold cache observing an in-progress retry). |
There was a problem hiding this comment.
This branch accepts Keeper's retry count but leaves file_status->retries unchanged. Consider two replicas sharing a Keeper path with loading_retries = 3: A exhausts a file and caches Failed with retries = 3; while A is idle, B runs SYSTEM DROP S3QUEUE FAILED FILES and fails the file once in a new cycle, creating a .retriable marker with retries = 0. The command clears B's local cache, but A retains its old entry.
When A next lists the file, getPathState returns Failed with Keeper's count of zero, so this branch falls through. However, hasNonProcessableState at line 661 still compares A's cached count of three and rejects the claim. The same problem exists in trySetProcessing at lines 502–503. reconcileFailedFilesCache also preserves this entry because the new .retriable node exists. If B becomes unavailable, A cannot take over the remaining retries, even after the object is repaired, until its cache entry is evicted or explicitly cleared.
Reconcile the cached retry state with the live marker under the processing lock, or otherwise ensure both claim paths use the validated Keeper retry decision instead of reapplying the exhausted cached count. Add a two-replica recovery test where the replica with the old exhausted cache must claim an under-budget retry from the new cycle after the other consumer stops.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes23 object files changed (+205.63 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units44 translation units recompiled, 391 s compile time in total, 44 of them have a recent master baseline. Symbol sizes
|
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
S3Queue: add
SYSTEM DROP S3QUEUE FAILED FILES [db.]table [ON CLUSTER cluster] [LIKE 'pattern']command to manually clear terminal failed-file entries from Keeper, either all of them or only those whose file path matches the pattern (substring match, as in SQLLIKE).Detailed Description
This is Phase 1 of splitting PR #113784 into smaller pull requests, following reviewer feedback.
Adds the
SYSTEM DROP S3QUEUE FAILED FILEScommand for S3Queue / AzureQueue tables:SYSTEM FLUSH OBJECT STORAGE QUEUEaccess for both local execution andON CLUSTER..retriablenodes, because they hold the retry counter of files that are still being retried.LIKE 'pattern'removes only the failed files whose storedfile_pathmatches the pattern (likePatternToRegexp+re2::RE2::PartialMatch, consistent withInterpreterDropQuery::matchesLikePattern). An explicit empty pattern (LIKE '') is distinguished from an omitted filter (like_patternisstd::optional<String>, preserved through formatting and AST JSON serialization), so it matches no non-empty path and drops nothing.LIKEis rejected withBAD_ARGUMENTSwhenpartitioning_mode = 'hive', sinceNodeMetadata::file_pathis not used there. Drop-all withoutLIKEworks in hive mode.cleanupTrackedNodes, andreconcileFailedFilesCache()runs at the end.SYSTEM FLUSH OBJECT STORAGE QUEUE, so the failed-files command does not print aPATHargument.This PR depends on PR #121752, which introduces the
failed_files_ttl_secsetting and related failed-file state management.Only the commits from
ec16ad1onwards (througha253551) are new in this PR; the rest come from #121752 and will disappear from the diff once it is merged.Bug fixed in this PR: the first version called
cleanupTrackedNodes(..., ttl = 0, limit = 0)expecting "0 means drop all". After #121752 that call returns early (and hitschassert(check_nodes_limit || check_nodes_ttl)in debug builds), so the command deleted nothing.dropFailedFilesnow has its own implementation.Tests (
test_failed_files_ttl.py):test_system_drop_failed_files_removes_terminal_nodes: drop-all removes terminal failed nodes.test_system_drop_failed_files_like_filter: two failed files;LIKE ''and an anchored prefix (alpha%) drop nothing,LIKE '%alpha%'removes only the matching one,LIKE '%bad.csv'removes the rest, and a plain drop works on an empty set.test_system_drop_failed_files_requires_access: a user without the grant getsACCESS_DENIED; a user withSYSTEM FLUSH OBJECT STORAGE QUEUEon the table succeeds.Not in this PR
ON CLUSTERexecution on replicas sharing a Keeper path (the losing replica currently throwsLOGICAL_ERROR), and the corresponding two-replica test. This is a follow-up.Workflow [PR]
Sync PR [sync-upstream/pr/125392]