Repository navigation
Delete the chunks of a recursive delete's descendants, sweep those left behind, and check rebuilds against the database - #38884
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
… and test a restore
…s wording on live rows
… it goes live, instead of waiting and flagging missed deletes
…, and start the sweep scenario from a swept index
Code Review ✅ Approved 🔴 High riskCascade deletes and leased sweeps remove chunk sets from shared indexes; coordination or liveness races could erase live entities’ search content. Deletes vector chunks for descendants of a recursive delete via the prepareHardDelete hook on ordered lanes, handles soft deletes and restores, and adds a sweep for chunks of entities no longer in the database. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
What
Stacked on PR #38841. Follows PR #38415.
prepareHardDeletehook, which every hard-deleted entity passes through, descendants of a recursive delete included, a type's entities together. After the commit, the chunks are deleted on the ordered lanes, one task per lane, behind updates already queued: one_mgetand two bulks. A chunk set still stored goes to the search retry queue. The delete event no longer deletes chunks. A logical test suite's hard delete, which skipped the hook, now calls it._meta.chunksOfDeletedEntitiesRemoved.Why
descendantsCoveredByAncestorCascadeskips each descendant's delete event, and child documents are deleted by ancestor id, which chunks do not carry. So after a service, database or schema was deleted, semantic search and AskCollate kept returning its tables: on main for both engines, on OpenSearch since 2.0.Decision record
ADR:2026-11-20-elasticsearch-and-opensearch-share-one-vector-index-service, v8, and ADR:2026-11-09-lifecycle-handlers-prepare-a-hard-delete-before-its-rows-are-removed, v2.
Verification
Local E2E (MySQL, stub embedder, counting proxy), main then this branch, same on Elasticsearch 9.3 and OpenSearch 3.4:
_mget, 29 bulks)VectorChunkIndexIT, 34/34 on both engines. The descendant scenarios fail on PR Vector chunk deletes trust the header bound and fail when it cannot be read #38841's head; the two rebuild scenarios (a delete from a server whose lookup found no generation; a delete that failed in it) fail before item 4.JobRecoveryOrphanDetectionTestfails without this PR too); the four new promotion tests fail before item 4.Pending: an E2E of item 4 (the table covers items 1 to 3), the full impacted plan, and a multi-node run.