[File-level concurrency] Conflict-time data skipping (min/max stats tier) #7358
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.59) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.59 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7358"
general
weight: 0.35
sezruby
Addresses #4470 (improved concurrency model for liquid / unpartitioned tables) at the file level — avoid conflicts when concurrent transactions touch disjoint files, decided by column statistics without reading row values. Part of the concurrency umbrella (#7360) — Case 1. Full design and rationale: #7356.
Summary
Reader-side conflict-time data skipping. Conflict detection currently filters candidate files by partition only. On an unpartitioned table — which includes every liquid-clustered table —
getFirstFileMatchingPartitionPredicatesreturnsfiles.headOption, so the append check conflicts on any concurrently-added file, even when the two operations touch entirely disjoint data ranges. This is the dominant source of false conflicts for liquid clustering, where incremental clustering and DML usually touch different clustering-key regions.This teaches conflict detection to apply the reader's column-statistics data skipping: an added file whose stats prove it cannot match the current transaction's data predicates is excluded from the conflict check.
What it does
ConflictChecker.getFirstFileMatchingPartitionPredicatesnow uses the data predicates of the current transaction's reads (DeltaTableReadPredicate.dataPredicates, previously ignored). On a partitioned table, each read's data predicates are combined only with that read's own partition predicate, so a concurrently-added file conflicts iff it could matchP_i AND D_ifor some readi. On an unpartitioned table, the reads' data predicates are OR-combined. Skipping isn't applied for a whole-table read, or when the transaction has no read predicates.ConflictDataSkippingReader, mixed intoDataSkippingReaderBase, builds the skipping condition with the reader'sDataFiltersBuilderandverifyStatsForFilter. It shares stats parsing (parseStats) and filter eligibility (DataSkippingReader.isIneligibleForDataSkipping) with the scan path.spark.databricks.delta.conflictDetection.dataSkipping.batchSize, internal, default 1000), so the check stops at the first batch with a matching file.delta.conflictDetection.dataSkipping.fallbackand treats the added files as conflicts, as with the feature off. A commit that used skipping recordsdelta.conflictDetection.dataSkipping.appliedonce, with the committed version.spark.databricks.delta.conflictDetection.dataSkipping.enabled(internal, default off). No protocol / reader / action changes.Which operations benefit (not just append)
The improved check is the added-files (append) check, which fires whenever the winner adds data files — so it is not only INSERT.
UPDATE/MERGEadd new row-image files, and because those are non-blind changed-data files they are checked under the default WriteSerializable (a blind INSERT is only checked under Serializable). So the headline beneficiaries are concurrent UPDATE / DELETE / MERGE on disjoint clustering ranges (different files), under the default isolation.This complements the same-file DV merge (#7357), splitting the space by which check fires:
| Concurrent DML shape | Check that fires | Handled by |
|---|---|---|
| different files (disjoint ranges) | append check | this PR (Case 1, #7356) |
| same file, disjoint rows | delete/delete, delete/read | #7357 (Case 2, DV merge) |
| same file, same rows | delete/ | neither (genuine conflict) |
Roles: the loser supplies the read predicate (
WHERE/ MERGEON); the winner supplies the added files whose stats are pruned. (A DV-DELETE winner re-adds the same file, so that's #7357's same-file case, not this PR's.)One-way safety
Data skipping here is sound in one direction only — a file is skipped only when its stats prove no overlap; a wrongly-skipped file would be a missed conflict. Guaranteed by reusing the reader's machinery:
expr || !verifyStatsForFilter(referencedStats)keeps any file whose referenced stats are missing/NULL.tightBounds=false) stats are safe:updateStatsToWideBoundskeeps min/max as valid outer bounds (a superset of live values), so wide bounds only cause fewer skips, never an unsafe one — the same property the reader uses to skip DV'd files. The effect on DV-heavy files is reduced benefit (conservative keep), not incorrectness.filesForScan. Dropping a conjunct only widens the condition.Correct across clusters/JVMs by construction — conflict detection is log-based: the loser reads the winner's committed stats from
_delta_logand evaluates skipping against its own local predicates (no shared state; deterministic; other-engine/no-stats writers are kept).Supersedes #7357's op-type append-suppression
The #7359 POC (issue #7357) shortcut the concurrent-
UPDATEcase with a blanket append-suppression for rewrite-only DML winners — skipping all* their new image files in the append check, keyed only on the winner's op type. That is unsound: anUPDATEcan flip a row into the loser's predicate (winnerSET x=15, loserDELETE WHERE x>10, row wasx=5), a genuine write-skew the suppression hides. Those image files are ordinary non-blind changed-data files and are correctly arbitrated by this PR's stats-based skip — abort on stats overlap (real flip), reconcile only on proven no-overlap, keep on missing stats. #7357 drops the suppression and depends on this PR; they stack (this data skipping under the DV merge).Testing
ConflictDataSkippingSuite(new, 26 tests) runs concurrent transactions in a fixed order:spark.databricks.delta.stats.skippingdisabled;appliedevent: not recorded when the winner adds no files, and recorded once per commit across several winning commits.With the flag off, conflict detection is unchanged: the unpartitioned check returns the first added file, and the partitioned check runs the same partition probe as before.
🤖 Generated with Claude Code