← Back to Pull requests

[flink] Keep delete records in the COMPACT_DELTA lookup refresh #10924

Closed
unknown closed this pull request without merging on Nov 02, 2026 14:50 UTC
View on GitHub
unknown unknown commented on Nov 01, 2026 17:29 UTC
Author

Purpose

close #10923

With lookup.cache = full (or join keys that are not the primary keys), a primary key table with the aggregation or partial-update merge engine, changelog-producer = none and a lookup strategy refreshes the lookup cache from the difference between the files before and after each compaction. LookupCompactDiffRead read that difference without keeping delete records, so a deleted row produced no record and the cache kept returning it.

The difference is now read with forceKeepDelete(), so a deleted row reaches the cache as a delete record, both when compaction keeps the delete record and when it drops the row. The initial full load is a separate read and does not change.

A delete record can carry only the key, like a sequence-group delete of a partial-update table. SecondaryIndexLookupTable removed the index entry by the secondary key of the delete record, so the entry of the deleted row stayed and later pointed to a reinserted row. It now removes the entry of the cached row, like an update does.

Tables with deletion vectors are not covered: streaming plans carry no deletion files, so a delete that compaction only writes into a deletion vector is not visible in this difference. #10813 handles deletion vectors for the partial lookup, which is a different path.

Tests

  • LookupJoinITCase#testLookupJoinDeletionPropagationAfterCompaction, for both ways a compaction handles a delete on an aggregation table with aggregation.remove-record-on-delete:

  • - false: the delete job compacts into an intermediate level and keeps the delete record.
    - true: the delete stays in level 0 (write-only), then a full compaction drops the row; $files shows that only one level-5 file is left.

    In both cases the lookup join must return (1, null) after the delete. On master it still returns (1, 10).

  • LookupJoinITCase#testLookupJoinBySecondaryKeyAfterKeyOnlyDelete, with the full and memory caches: a partial-update table joined on f1 gets the sequence-group delete (1, NULL, 2) and then (1, 22, 3). Lookup key 11 must return nothing after the delete and after the reinsert, and 22 must return the new row. On master 11 still returns the deleted row after the delete; without the SecondaryIndexLookupTable change it returns (1, 22, 3) after the reinsert.

  • LookupTableTest#testSecKeyTableDeleteWithoutSecKey: the same delete and reinsert directly on the lookup table, for both state backends.
  • API and Format

    no

    Documentation

    no

    Diff: 315 lines (+236 / -79) across 3 files Reviewer: LuciferYang Review duration: 1281m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 315 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.344
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10924"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.9% · Safe to merge
    15.9%
    Repository