Root Cause Analysis
DirtySnapshot is created on stack, but will be recorded in Resowner.
If transaction abort, there is no chance to remove snapshot from resource owner anyway, which caused invalid memory access.
The stack trace:
_bt_check_unique(DirtySnapshot is created here)
-> table_index_fetch_tuple_check
-> ...
-> AppendOnlyVisimapStore_Init
-> RegisterSnapshot(snapshot)
UnregisterSnapshot is called in AppendOnlyVisimapStore_Finish. If transaction aborts, there is no chance to call AppendOnlyVisimapStore_Finish.
Reproduce steps
Root Cause Analysis
DirtySnapshot is created on stack, but will be recorded in Resowner.
If transaction abort, there is no chance to remove snapshot from resource owner anyway, which caused invalid memory access.
The stack trace:
UnregisterSnapshot is called in AppendOnlyVisimapStore_Finish. If transaction aborts, there is no chance to call AppendOnlyVisimapStore_Finish.
Reproduce steps