Skip to content

Commit 3ce0359

Browse files
committed
Fix TAM segfault on DELETE using segmentby column
If a whole segment is deleted in a Hypercore TAM table, a segmentation fault can be triggered that results from reading freed data. After calling `table_open()` and locking the table in `LockRelationOid()` all invalidation messages will be processed. This can invalidate the `rd_amcache` field for the relation, but also for other relations. As a result, this caused clobbered data to be used when finding the count column in the compressed relation since the attribute number was 0x7f7f when first fetching HypercoreInfo using `RelationGetHypercoreInfo()`, calling `table_open()`, and then trying to use the data in the structure again. This commit fixes this by not re-using data returned by `RelationGetHypercoreInfo()` after calling `table_open()`. Since one of the more common cases for this is opening the compressed table beloning to a chunk, a new function were introduced for handling this case. It also moves calls to `RelationGetHypercoreInfo()` inside functions that need the data to avoid re-using the data after calls that can invalidate the cache.
1 parent 17fb43d commit 3ce0359

File tree

3 files changed

+97
-91
lines changed

3 files changed

+97
-91
lines changed

.unreleased/pr_7935

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes: #7935 Fix TAM segfault on DELETE using segmentby column

0 commit comments

Comments
 (0)