Skip to content

Commit 30d248b

Browse files
committed
Purge CheckXidAlive checks in heap_getnext.
They were broken since birth. If we want to add something like that, we should reset CheckXidAlive before coming there or pass some flag not to check it. (cherry picked from commit 31accac456987a06307dafafc4d5862495e786a8)
1 parent 9b8e7c3 commit 30d248b

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

src/backend/access/heap/heapam.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,17 +1834,6 @@ heap_update_snapshot(HeapScanDesc scan, Snapshot snapshot)
18341834
HeapTuple
18351835
heap_getnext(HeapScanDesc scan, ScanDirection direction)
18361836
{
1837-
/*
1838-
* We don't expect direct calls to heap_getnext with valid
1839-
* CheckXidAlive for regular tables. Track that below.
1840-
*/
1841-
if (unlikely(TransactionIdIsValid(CheckXidAlive) &&
1842-
!(IsCatalogRelation(scan->rs_rd) ||
1843-
RelationIsUsedAsCatalogTable(scan->rs_rd))))
1844-
ereport(ERROR,
1845-
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
1846-
errmsg("improper heap_getnext call")));
1847-
18481837
/* Note: no locking manipulations needed */
18491838

18501839
HEAPDEBUG_1; /* heap_getnext( info ) */
@@ -1925,16 +1914,6 @@ heap_fetch(Relation relation,
19251914
OffsetNumber offnum;
19261915
bool valid;
19271916

1928-
/*
1929-
* We don't expect direct calls to heap_fetch with valid
1930-
* CheckXidAlive for regular tables. Track that below.
1931-
*/
1932-
if (unlikely(TransactionIdIsValid(CheckXidAlive) &&
1933-
!(IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation))))
1934-
ereport(ERROR,
1935-
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
1936-
errmsg("improper heap_fetch call")));
1937-
19381917
/*
19391918
* Fetch and pin the appropriate page of the relation.
19401919
*/
@@ -2067,16 +2046,6 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer,
20672046
bool valid;
20682047
bool skip;
20692048

2070-
/*
2071-
* We don't expect direct calls to heap_hot_search_buffer with
2072-
* valid CheckXidAlive for regular tables. Track that below.
2073-
*/
2074-
if (unlikely(TransactionIdIsValid(CheckXidAlive) &&
2075-
!(IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation))))
2076-
ereport(ERROR,
2077-
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
2078-
errmsg("improper heap_hot_search_buffer call")));
2079-
20802049
/* If this is not the first call, previous call returned a (live!) tuple */
20812050
if (all_dead)
20822051
*all_dead = first_call;
@@ -2218,16 +2187,6 @@ heap_hot_search(ItemPointer tid, Relation relation, Snapshot snapshot,
22182187
Buffer buffer;
22192188
HeapTupleData heapTuple;
22202189

2221-
/*
2222-
* We don't expect direct calls to heap_hot_search with
2223-
* valid CheckXidAlive for regular tables. Track that below.
2224-
*/
2225-
if (unlikely(TransactionIdIsValid(CheckXidAlive) &&
2226-
!(IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation))))
2227-
ereport(ERROR,
2228-
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
2229-
errmsg("improper heap_hot_search call")));
2230-
22312190
buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
22322191
LockBuffer(buffer, BUFFER_LOCK_SHARE);
22332192
result = heap_hot_search_buffer(tid, relation, buffer, snapshot,
@@ -2257,16 +2216,6 @@ heap_get_latest_tid(Relation relation,
22572216
ItemPointerData ctid;
22582217
TransactionId priorXmax;
22592218

2260-
/*
2261-
* We don't expect direct calls to heap_get_latest_tid with valid
2262-
* CheckXidAlive for regular tables. Track that below.
2263-
*/
2264-
if (unlikely(TransactionIdIsValid(CheckXidAlive) &&
2265-
!(IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation))))
2266-
ereport(ERROR,
2267-
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
2268-
errmsg("improper heap_get_latest_tid call")));
2269-
22702219
/* this is to avoid Assert failures on bad input */
22712220
if (!ItemPointerIsValid(tid))
22722221
return;

0 commit comments

Comments
 (0)