mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
tableam: Add and use table_fetch_row_version().
This is essentially the tableam version of heapam_fetch(), i.e. fetching a tuple identified by a tid, performing visibility checks. Note that this different from table_index_fetch_tuple(), which is for index lookups. It therefore has to handle a tid pointing to an earlier version of a tuple if the AM uses an optimization like heap's HOT. Add comments to that end. This commit removes the stats_relation argument from heap_fetch, as it's been unused for a long time. Author: Andres Freund Reviewed-By: Haribabu Kommi Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
This commit is contained in:
@ -1388,8 +1388,7 @@ bool
|
||||
heap_fetch(Relation relation,
|
||||
Snapshot snapshot,
|
||||
HeapTuple tuple,
|
||||
Buffer *userbuf,
|
||||
Relation stats_relation)
|
||||
Buffer *userbuf)
|
||||
{
|
||||
ItemPointer tid = &(tuple->t_self);
|
||||
ItemId lp;
|
||||
@ -1468,10 +1467,6 @@ heap_fetch(Relation relation,
|
||||
*/
|
||||
*userbuf = buffer;
|
||||
|
||||
/* Count the successful fetch against appropriate rel, if any */
|
||||
if (stats_relation != NULL)
|
||||
pgstat_count_heap_fetch(stats_relation);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -5097,7 +5092,7 @@ heap_lock_updated_tuple_rec(Relation rel, ItemPointer tid, TransactionId xid,
|
||||
block = ItemPointerGetBlockNumber(&tupid);
|
||||
ItemPointerCopy(&tupid, &(mytup.t_self));
|
||||
|
||||
if (!heap_fetch(rel, SnapshotAny, &mytup, &buf, NULL))
|
||||
if (!heap_fetch(rel, SnapshotAny, &mytup, &buf))
|
||||
{
|
||||
/*
|
||||
* if we fail to find the updated version of the tuple, it's
|
||||
|
Reference in New Issue
Block a user