mrhhsg opened a new pull request, #71234: URL: https://github.com/apache/doris/pull/71234
### Background Spill files can live on local disks or in object-storage vaults. Query teardown currently attempts filesystem deletion before handing a failed deletion to the spill manager. ### What problem does this PR solve? Issue Number: None Related PR: #70474 (original combined patch), #71048 (preparatory refactor) PR Type: Bugfix Problem Summary: Physical deletion and remote delete reconciliation can stall query teardown. Queue local and remote cleanup instead, and ensure that local files left at shutdown can be isolated and collected on the next start. ### Details - **Change map:** Production +127/-165, tests +344/-20. BE production code and targeted BE tests only. Startup/metrics and the physical deletion queue are the two parts of this fix. - **Frequency:** Query or spill-file teardown during slow local or remote deletion; shutdown can leave new cleanup work after the GC loop stops. - **Root cause:** Teardown called the filesystem directly; moving all deletes to the old queue would also make normal producers repeatedly scan the backlog under the shared mutex. - **Why existing tests missed it:** They generally expected synchronous deletion or only put failed deletes in the queue. - **Fix:** Enqueue without scanning; drain and coalesce duplicate/ancestor requests outside the queue lock, preserving the filesystem snapshot, reservations, layouts and per-file log context. Quarantine stale local roots at startup and reject a failed rename. Own the metrics entity even when initialization fails. - **Other paths and branches:** Keep external directory leases, the retry time slice and synchronous writer teardown. No upload admission, remote config, FE, or protocol change. ### Testing - Clang-format 16, build hygiene and `git diff --check` passed. - ASAN BE UT not yet completed on this split head; no test result is claimed. Command: `ENABLE_PCH=off USE_LIBCPP=OFF BUILD_TYPE_UT=ASAN ./run-be-ut.sh --run --filter=SpillGcQueueTest.*:SpillFileTest.*:SpillFileManagerTest.*:SpillFileS3Test.*:SpillRepartitionerTest.*:SpillSortSourceOperatorTest.* -j20`. - No live-object-storage or SQL regression result is claimed here. ### Notes for Reviewers Start with `SpillFile::gc()` and `SpillFileManager::_coalesce_pending_directories()`. A queued item keeps its charged bytes until deletion succeeds; the retained-object metric can separately reconcile a partial remote delete. Shutdown does not start another pass, but joins the one already running. A pending remote object can survive restart, so the bucket's existing spill lifecycle rule remains necessary. ### Release note Physical spill deletion and its retries no longer run on query teardown threads. Unfinished uploads may still delay writer teardown, and local leftovers are recovered after restart. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: Yes; separate remote-spill user documentation is deferred. - Pre-submission status: Partially verified; see Testing. ### AI Disclosure - Tool: Codex - Generated: Patch extraction, targeted adaptations, and description. - Human review: Pending author review. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
