[Spark] List _change_data separately to speed up VACUUM listing #7448
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.53) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.53 · 462 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.367
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7448"
general
weight: 0.35
sezruby
Description
VACUUM now lists the table's
_change_datadirectory as its own listing branch instead of recursing into it inline. Gated by an internal config (vacuum.listing.changeDataDirSeparately.enabled, defaulttrue).Resolves #7447. Related to #2201 (closed) — same listing-parallelism bottleneck, targeted at the common CDF case rather than a general
initialListingDepthknob.Why
VACUUM discovers files by:
1. shallow-listing the table root,
2. distributing that first level across the cluster, then
3. recursing each first-level directory in a single task.
_change_datais one of those first-level directories, and it mirrors the table's partitioning (or is a single large flat directory), so it can hold a large fraction of the table's files. Recursing it inline leaves one task listing that entire subtree while the rest of the cluster is idle — typically the tail of VACUUM on tables with Change Data Feed enabled. Simply deepening the initial listing does not help the common case where_change_datais a flat directory: there are no sub-directories to spread, so it is still a singlelistStatus.What changed
VacuumCommand.getFilesFromFilesystemexcludes the table root's_change_datafrom the main listing and lists it through a separaterecursiveListDirscall. Its sub-directories then get their own repartition + parallel recursion, and because the two branches areunioned Spark schedules them concurrently.DeltaFileOperations.recursiveListDirsgets an optionalfirstLevelHiddenDirNameFilter(default: hides nothing). It applies only to the first, non-recursive listing of the given roots, whilehiddenDirNameFilterapplies at every depth. VACUUM uses it to exclude the root's_change_data, so a_change_datadirectory deeper in the tree (for examplepart=1/_change_data/) is still part of the main listing._change_datadirectory entry itself is emitted explicitly (the listing helper emits the contents of its roots, not the roots), so empty-directory cleanup behaves exactly as before.getFileStatuscall decides the path. If the table has no_change_datadirectory,_change_datais a file, or the config is off, the original single-call listing path is used unchanged.The set of files considered by VACUUM is identical; only the listing parallelism differs.
Benchmark
VACUUM ... RETAIN 0 HOURS DRY RUN(listing only, no deletes) on a 10,000-partition CDF-enabled table whose_change_datasubtree mirrors the partitioning (10,000 sub-directories, one file each), over cloud object storage, 3 interleaved runs per mode:| Mode | runs (s) | best (s) |
| --- | --- | --- |
| inline (current) | 117.6, 84.8, 110.6 | 84.8 |
| separate branch | 31.8, 28.3, 29.3 | 28.3 |
Best-of-3 ≈ 3.0× faster listing; both modes return the identical 10,000 candidate files.
How was this patch tested?
VACUUM removes the same untracked _change_data files whether listed separately or inline— end-to-end SQL VACUUM run with the config both on and off. It checks that the same untracked files are removed and the tracked file is kept. The untracked files include one nested deep under_change_dataand one in a_change_datadirectory below a partition directory (part=1/_change_data/orphan.txt).DeltaVacuumSuitepasses locally.Does this PR introduce _any_ user-facing changes?
No. The set of files VACUUM considers is unchanged; this only changes listing parallelism. The behavior is gated by an internal config that defaults on and falls back to the original path when there is no
_change_datadirectory.🤖 Generated with Claude Code