Disable cached physical-plan reuse for parameterized write statements - #876
Closed
ericyuanhui wants to merge 1 commit into
Closed
Disable cached physical-plan reuse for parameterized write statements#876ericyuanhui wants to merge 1 commit into
ericyuanhui wants to merge 1 commit into
Conversation
Signed-off-by: ericyuanhui <285521263@qq.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #875
Root Cause
The Python API implicitly caches parameterized prepared statements. When parameter types remain unchanged, repeated write executions previously reused the cached physical plan and execution-state allocations.
For MERGE ... SET r.property = ..., the MERGE operator projects the relationship internal ID into a result vector, and the following SET_PROPERTY operator consumes that ID.
A relationship created by MERGE receives a transaction-local ID. On a later auto-commit execution, a stale relationship ID from the previous execution can remain visible to SET_PROPERTY. The new transaction has no corresponding LocalRelTable, so RelTable::update() obtains a null local table and dereferences it, causing a segmentation fault.
This does not affect a plain relationship MERGE without a subsequent property update because no SET_PROPERTY operator consumes the projected relationship ID.
Fix
Disable cached physical-plan reuse for parameterized write statements.
Parameterized writes still reuse the cached parsed statement and logical plan, but each execution now rebuilds its physical plan and execution state. This prevents transaction-local IDs from surviving across auto-commit transactions.
Cached physical-plan reuse remains enabled for read-only parameterized statements.