diff options
| author | Robert Haas <rhaas@postgresql.org> | 2013-07-22 13:26:33 -0400 |
|---|---|---|
| committer | Robert Haas <rhaas@postgresql.org> | 2013-07-22 13:38:44 -0400 |
| commit | 0518eceec3a1cc2b71da04e839f05f555fdd8567 (patch) | |
| tree | d35c1107e52c8f5e92edf4022430e544d0dfb763 /src/include | |
| parent | 0aeb5ae2041520f02cabbc7083aec46733689bce (diff) | |
Adjust HeapTupleSatisfies* routines to take a HeapTuple.
Previously, these functions took a HeapTupleHeader, but upcoming
patches for logical replication will introduce new a new snapshot
type under which the tuple's TID will be used to lookup (CMIN, CMAX)
for visibility determination purposes. This makes that information
available. Code churn is minimal since HeapTupleSatisfiesVisibility
took the HeapTuple anyway, and deferenced it before calling the
satisfies function.
Independently of logical replication, this allows t_tableOid and
t_self to be cross-checked via assertions in tqual.c. This seems
like a useful way to make sure that all callers are setting these
values properly, which has been previously put forward as
desirable.
Andres Freund, reviewed by Álvaro Herrera
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/utils/snapshot.h | 4 | ||||
| -rw-r--r-- | src/include/utils/tqual.h | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/include/utils/snapshot.h b/src/include/utils/snapshot.h index e747191e793..ed3f58692ea 100644 --- a/src/include/utils/snapshot.h +++ b/src/include/utils/snapshot.h @@ -27,8 +27,8 @@ typedef struct SnapshotData *Snapshot; * The specific semantics of a snapshot are encoded by the "satisfies" * function. */ -typedef bool (*SnapshotSatisfiesFunc) (HeapTupleHeader tuple, - Snapshot snapshot, Buffer buffer); +typedef bool (*SnapshotSatisfiesFunc) (HeapTuple htup, + Snapshot snapshot, Buffer buffer); typedef struct SnapshotData { diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h index 465231c7584..800e366f30b 100644 --- a/src/include/utils/tqual.h +++ b/src/include/utils/tqual.h @@ -52,7 +52,7 @@ extern PGDLLIMPORT SnapshotData SnapshotToastData; * if so, the indicated buffer is marked dirty. */ #define HeapTupleSatisfiesVisibility(tuple, snapshot, buffer) \ - ((*(snapshot)->satisfies) ((tuple)->t_data, snapshot, buffer)) + ((*(snapshot)->satisfies) (tuple, snapshot, buffer)) /* Result codes for HeapTupleSatisfiesVacuum */ typedef enum @@ -65,25 +65,25 @@ typedef enum } HTSV_Result; /* These are the "satisfies" test routines for the various snapshot types */ -extern bool HeapTupleSatisfiesMVCC(HeapTupleHeader tuple, +extern bool HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot, Buffer buffer); -extern bool HeapTupleSatisfiesNow(HeapTupleHeader tuple, +extern bool HeapTupleSatisfiesNow(HeapTuple htup, Snapshot snapshot, Buffer buffer); -extern bool HeapTupleSatisfiesSelf(HeapTupleHeader tuple, +extern bool HeapTupleSatisfiesSelf(HeapTuple htup, Snapshot snapshot, Buffer buffer); -extern bool HeapTupleSatisfiesAny(HeapTupleHeader tuple, +extern bool HeapTupleSatisfiesAny(HeapTuple htup, Snapshot snapshot, Buffer buffer); -extern bool HeapTupleSatisfiesToast(HeapTupleHeader tuple, +extern bool HeapTupleSatisfiesToast(HeapTuple htup, Snapshot snapshot, Buffer buffer); -extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple, +extern bool HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot, Buffer buffer); /* Special "satisfies" routines with different APIs */ -extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, +extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, Buffer buffer); -extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, +extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin, Buffer buffer); -extern bool HeapTupleIsSurelyDead(HeapTupleHeader tuple, +extern bool HeapTupleIsSurelyDead(HeapTuple htup, TransactionId OldestXmin); extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, |
