Skip to content

fix: handle stale TID in VLE path materialization after DETACH DELETE (#2549) - #2550

Open
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-2549-stale-tid-path-projection
Open

fix: handle stale TID in VLE path materialization after DETACH DELETE (#2549)#2550
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-2549-stale-tid-path-projection

Conversation

@waterWang

Copy link
Copy Markdown

Fixes #2549

When a VLE path is bound via MATCH p = ... and the bound vertices are
subsequently DETACH DELETE'd, RETURN p raises an internal stale-TID
error because the VLE path materializer (build_path) lazily fetches
vertex/edge properties via heap_fetch after the underlying tuples have
been deleted.

This commit adds tolerant variants of get_vertex_entry_properties and
get_edge_entry_properties that return an empty properties object ({})
when the stored TID no longer resolves to a visible tuple, allowing
the path to be projected with the vertex present but its properties
empty.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes an internal stale TID error when projecting variable-length relationship (VLE) paths after DETACH DELETE, by making VLE path materialization tolerant of deleted tuples and returning empty properties ({}) when the stored TID is no longer visible.

Changes:

  • Introduces “graceful” property accessors for vertex/edge entries that return {} instead of erroring on stale TIDs.
  • Updates VLE path materialization (build_path / edge list construction) to use the graceful accessors.
  • Adds a regression test and expected output to cover the MATCH p ... DETACH DELETE ... RETURN p scenario.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/include/utils/age_global_graph.h Adds public prototypes for tolerant (“graceful”) vertex/edge property accessors.
src/backend/utils/adt/age_vle.c Switches VLE path/edge materialization to use the graceful property accessors.
src/backend/utils/adt/age_global_graph.c Implements graceful property accessors that return {} when heap fetch fails due to stale TIDs.
regress/sql/cypher_vle.sql Adds a regression query reproducing Issue #2549.
regress/expected/cypher_vle.out Adds expected output for the new regression coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +491 to +495
-- Issue #2549: VLE path + DETACH DELETE + RETURN p should not raise
-- stale TID error. When the path's bound vertices are deleted before
-- the path datum is materialized, build_path must tolerate the stale
-- TID and return the path with empty properties ({}) for the deleted
-- entities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stale TID` after deleting a path-bound vertex

2 participants