From c91560defc57f89f7e88632ea14ae77b5cec78ee Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 21 Jan 2019 17:03:15 -0800 Subject: [PATCH] Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c. Given these routines are heap specific, and that there will be more generic visibility support in via table AM, it makes sense to move the prototypes to heapam.h (routines like HeapTupleSatisfiesVacuum will not be exposed in a generic fashion, because they are too storage specific). Similarly, the code in tqual.c is specific to heap, so moving it into access/heap/ makes sense. Author: Andres Freund Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de --- contrib/pg_visibility/pg_visibility.c | 1 - contrib/pgrowlocks/pgrowlocks.c | 1 - contrib/pgstattuple/pgstatapprox.c | 2 +- contrib/pgstattuple/pgstattuple.c | 1 - src/backend/access/heap/Makefile | 4 +- src/backend/access/heap/heapam.c | 8 +-- .../heap/heapam_visibility.c} | 8 +-- src/backend/access/heap/pruneheap.c | 1 - src/backend/access/heap/rewriteheap.c | 1 - src/backend/access/heap/tuptoaster.c | 1 - src/backend/access/heap/vacuumlazy.c | 1 - src/backend/access/index/genam.c | 1 - src/backend/access/spgist/spgvacuum.c | 2 +- src/backend/access/transam/transam.c | 4 +- src/backend/access/transam/xact.c | 8 +-- src/backend/catalog/index.c | 1 - src/backend/commands/analyze.c | 2 +- src/backend/commands/async.c | 2 +- src/backend/commands/cluster.c | 1 - src/backend/executor/nodeBitmapHeapscan.c | 1 - src/backend/executor/nodeModifyTable.c | 1 - src/backend/executor/nodeSamplescan.c | 1 - .../replication/logical/reorderbuffer.c | 4 +- src/backend/replication/logical/snapbuild.c | 2 +- src/backend/storage/ipc/procarray.c | 2 +- src/backend/storage/lmgr/predicate.c | 2 +- src/backend/utils/adt/ri_triggers.c | 2 +- src/backend/utils/cache/inval.c | 6 +- src/backend/utils/time/Makefile | 2 +- src/include/access/heapam.h | 34 +++++++++++ src/include/utils/snapshot.h | 3 +- src/include/utils/tqual.h | 56 ------------------- 32 files changed, 65 insertions(+), 101 deletions(-) rename src/backend/{utils/time/tqual.c => access/heap/heapam_visibility.c} (99%) delete mode 100644 src/include/utils/tqual.h diff --git a/contrib/pg_visibility/pg_visibility.c b/contrib/pg_visibility/pg_visibility.c index d8125f1ba2..3282742b80 100644 --- a/contrib/pg_visibility/pg_visibility.c +++ b/contrib/pg_visibility/pg_visibility.c @@ -22,7 +22,6 @@ #include "storage/smgr.h" #include "utils/rel.h" #include "utils/snapmgr.h" -#include "utils/tqual.h" PG_MODULE_MAGIC; diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c index 2cb3d1ca3b..df2ad7f2c9 100644 --- a/contrib/pgrowlocks/pgrowlocks.c +++ b/contrib/pgrowlocks/pgrowlocks.c @@ -38,7 +38,6 @@ #include "utils/builtins.h" #include "utils/rel.h" #include "utils/snapmgr.h" -#include "utils/tqual.h" #include "utils/varlena.h" PG_MODULE_MAGIC; diff --git a/contrib/pgstattuple/pgstatapprox.c b/contrib/pgstattuple/pgstatapprox.c index 4f449a26c1..ff7c255a2d 100644 --- a/contrib/pgstattuple/pgstatapprox.c +++ b/contrib/pgstattuple/pgstatapprox.c @@ -12,6 +12,7 @@ */ #include "postgres.h" +#include "access/heapam.h" #include "access/relation.h" #include "access/transam.h" #include "access/visibilitymap.h" @@ -26,7 +27,6 @@ #include "storage/procarray.h" #include "storage/lmgr.h" #include "utils/builtins.h" -#include "utils/tqual.h" #include "commands/vacuum.h" PG_FUNCTION_INFO_V1(pgstattuple_approx); diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c index 8f67c3c220..2ac9863463 100644 --- a/contrib/pgstattuple/pgstattuple.c +++ b/contrib/pgstattuple/pgstattuple.c @@ -36,7 +36,6 @@ #include "storage/bufmgr.h" #include "storage/lmgr.h" #include "utils/builtins.h" -#include "utils/tqual.h" #include "utils/varlena.h" PG_MODULE_MAGIC; diff --git a/src/backend/access/heap/Makefile b/src/backend/access/heap/Makefile index 7e7324a916..eae36fdbf4 100644 --- a/src/backend/access/heap/Makefile +++ b/src/backend/access/heap/Makefile @@ -12,7 +12,7 @@ subdir = src/backend/access/heap top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global -OBJS = heapam.o hio.o pruneheap.o rewriteheap.o syncscan.o tuptoaster.o \ - vacuumlazy.o visibilitymap.o +OBJS = heapam.o heapam_visibility.o hio.o pruneheap.o rewriteheap.o \ + syncscan.o tuptoaster.o vacuumlazy.o visibilitymap.o include $(top_srcdir)/src/backend/common.mk diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index dc2ff89d27..b9862247fb 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -66,7 +66,6 @@ #include "utils/lsyscache.h" #include "utils/relcache.h" #include "utils/snapmgr.h" -#include "utils/tqual.h" /* GUC variable */ @@ -5284,8 +5283,8 @@ test_lockmode_for_conflict(MultiXactStatus status, TransactionId xid, /* * Note: we *must* check TransactionIdIsInProgress before - * TransactionIdDidAbort/Commit; see comment at top of tqual.c for an - * explanation. + * TransactionIdDidAbort/Commit; see comment at top of heapam_visibility.c + * for an explanation. */ if (TransactionIdIsCurrentTransactionId(xid)) { @@ -6254,7 +6253,8 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask, * * As with all tuple visibility routines, it's critical to test * TransactionIdIsInProgress before TransactionIdDidCommit, - * because of race conditions explained in detail in tqual.c. + * because of race conditions explained in detail in + * heapam_visibility.c. */ if (TransactionIdIsCurrentTransactionId(xid) || TransactionIdIsInProgress(xid)) diff --git a/src/backend/utils/time/tqual.c b/src/backend/access/heap/heapam_visibility.c similarity index 99% rename from src/backend/utils/time/tqual.c rename to src/backend/access/heap/heapam_visibility.c index 71d7e25777..86a99943eb 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/access/heap/heapam_visibility.c @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------- * - * tqual.c - * POSTGRES "time qualification" code, ie, tuple visibility rules. + * heapam_visibility.c + * Tuple visibility rules for tuples stored in heap. * * NOTE: all the HeapTupleSatisfies routines will update the tuple's * "hint" status bits if we see that the inserting or deleting transaction @@ -56,13 +56,14 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * src/backend/utils/time/tqual.c + * src/backend/access/heap/heapam_visibility.c * *------------------------------------------------------------------------- */ #include "postgres.h" +#include "access/heapam.h" #include "access/htup_details.h" #include "access/multixact.h" #include "access/subtrans.h" @@ -74,7 +75,6 @@ #include "utils/builtins.h" #include "utils/combocid.h" #include "utils/snapmgr.h" -#include "utils/tqual.h" /* diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c index 2665f24730..a3e51922d8 100644 --- a/src/backend/access/heap/pruneheap.c +++ b/src/backend/access/heap/pruneheap.c @@ -25,7 +25,6 @@ #include "storage/bufmgr.h" #include "utils/snapmgr.h" #include "utils/rel.h" -#include "utils/tqual.h" /* Working data for heap_page_prune and subroutines */ typedef struct diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index f6b0f1b093..f5cf9ffc9c 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -130,7 +130,6 @@ #include "utils/memutils.h" #include "utils/rel.h" -#include "utils/tqual.h" #include "storage/procarray.h" diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c index 6763fb920c..cd921a4600 100644 --- a/src/backend/access/heap/tuptoaster.c +++ b/src/backend/access/heap/tuptoaster.c @@ -42,7 +42,6 @@ #include "utils/rel.h" #include "utils/snapmgr.h" #include "utils/typcache.h" -#include "utils/tqual.h" #undef TOAST_DEBUG diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index c09eb6eff8..37aa484ec3 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -59,7 +59,6 @@ #include "utils/memutils.h" #include "utils/pg_rusage.h" #include "utils/timestamp.h" -#include "utils/tqual.h" /* diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index ffd79ffca7..e0a5ea42d5 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -35,7 +35,6 @@ #include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/syscache.h" -#include "utils/tqual.h" /* ---------------------------------------------------------------- diff --git a/src/backend/access/spgist/spgvacuum.c b/src/backend/access/spgist/spgvacuum.c index ccb5ac402c..b9311ce595 100644 --- a/src/backend/access/spgist/spgvacuum.c +++ b/src/backend/access/spgist/spgvacuum.c @@ -192,7 +192,7 @@ vacuumLeafPage(spgBulkDeleteState *bds, Relation index, Buffer buffer, * happened since VACUUM started. * * Note: we could make a tighter test by seeing if the xid is - * "running" according to the active snapshot; but tqual.c doesn't + * "running" according to the active snapshot; but snapmgr.c doesn't * currently export a suitable API, and it's not entirely clear * that a tighter test is worth the cycles anyway. */ diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index e55611ae09..365ddfb428 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -228,8 +228,8 @@ TransactionIdDidAbort(TransactionId transactionId) * (and so it's not named TransactionIdDidComplete, which would be the * appropriate name for a function that worked that way). The intended * use is just to short-circuit TransactionIdIsInProgress calls when doing - * repeated tqual.c checks for the same XID. If this isn't extremely fast - * then it will be counterproductive. + * repeated heapam_visibility.c checks for the same XID. If this isn't + * extremely fast then it will be counterproductive. * * Note: * Assumes transaction identifier is valid. diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 18467d96d2..7c3a9c1e89 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -774,10 +774,10 @@ TransactionIdIsCurrentTransactionId(TransactionId xid) * We always say that BootstrapTransactionId is "not my transaction ID" * even when it is (ie, during bootstrap). Along with the fact that * transam.c always treats BootstrapTransactionId as already committed, - * this causes the tqual.c routines to see all tuples as committed, which - * is what we need during bootstrap. (Bootstrap mode only inserts tuples, - * it never updates or deletes them, so all tuples can be presumed good - * immediately.) + * this causes the heapam_visibility.c routines to see all tuples as + * committed, which is what we need during bootstrap. (Bootstrap mode + * only inserts tuples, it never updates or deletes them, so all tuples + * can be presumed good immediately.) * * Likewise, InvalidTransactionId and FrozenTransactionId are certainly * not my transaction ID, so we can just return "false" immediately for diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b6d472335f..7359600fd3 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -75,7 +75,6 @@ #include "utils/syscache.h" #include "utils/tuplesort.h" #include "utils/snapmgr.h" -#include "utils/tqual.h" /* Potentially set by pg_upgrade_support functions */ diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 83625d10e7..c8192353eb 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -17,6 +17,7 @@ #include #include "access/genam.h" +#include "access/heapam.h" #include "access/multixact.h" #include "access/relation.h" #include "access/sysattr.h" @@ -63,7 +64,6 @@ #include "utils/sortsupport.h" #include "utils/syscache.h" #include "utils/timestamp.h" -#include "utils/tqual.h" /* Per-index data for ANALYZE */ diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 0099b88137..5a7ee0de4c 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -1955,7 +1955,7 @@ asyncQueueProcessPageEntries(volatile QueuePosition *current, * Note that we must test XidInMVCCSnapshot before we test * TransactionIdDidCommit, else we might return a message from * a transaction that is not yet visible to snapshots; compare - * the comments at the head of tqual.c. + * the comments at the head of heapam_visibility.c. * * Also, while our own xact won't be listed in the snapshot, * we need not check for TransactionIdIsCurrentTransactionId diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 99e25cd50f..5c0f238c7e 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -52,7 +52,6 @@ #include "utils/relmapper.h" #include "utils/snapmgr.h" #include "utils/syscache.h" -#include "utils/tqual.h" #include "utils/tuplesort.h" diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index cd20abc141..5e74585d5e 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -51,7 +51,6 @@ #include "utils/rel.h" #include "utils/spccache.h" #include "utils/snapmgr.h" -#include "utils/tqual.h" static TupleTableSlot *BitmapHeapNext(BitmapHeapScanState *node); diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 241711a81d..566858c19b 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -53,7 +53,6 @@ #include "utils/builtins.h" #include "utils/memutils.h" #include "utils/rel.h" -#include "utils/tqual.h" static bool ExecOnConflictUpdate(ModifyTableState *mtstate, diff --git a/src/backend/executor/nodeSamplescan.c b/src/backend/executor/nodeSamplescan.c index 7d4f17b4e9..da4a65fd30 100644 --- a/src/backend/executor/nodeSamplescan.c +++ b/src/backend/executor/nodeSamplescan.c @@ -25,7 +25,6 @@ #include "storage/predicate.h" #include "utils/builtins.h" #include "utils/rel.h" -#include "utils/tqual.h" static TupleTableSlot *SampleNext(SampleScanState *node); static void tablesample_init(SampleScanState *scanstate); diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index b79ce5db95..a49e226967 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -56,6 +56,7 @@ #include #include +#include "access/heapam.h" #include "access/rewriteheap.h" #include "access/transam.h" #include "access/tuptoaster.h" @@ -78,7 +79,6 @@ #include "utils/memutils.h" #include "utils/rel.h" #include "utils/relfilenodemap.h" -#include "utils/tqual.h" /* entry for a hash table we use to map from xid to our transaction state */ @@ -1269,7 +1269,7 @@ ReorderBufferCleanupTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) /* * Build a hash with a (relfilenode, ctid) -> (cmin, cmax) mapping for use by - * tqual.c's HeapTupleSatisfiesHistoricMVCC. + * HeapTupleSatisfiesHistoricMVCC. */ static void ReorderBufferBuildTupleCidHash(ReorderBuffer *rb, ReorderBufferTXN *txn) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 2310e9fafe..2f185f7823 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -1119,7 +1119,7 @@ SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn, xl_running_xact * NB: We only increase xmax when a catalog modifying transaction commits * (see SnapBuildCommitTxn). Because of this, xmax can be lower than * xmin, which looks odd but is correct and actually more efficient, since - * we hit fast paths in tqual.c. + * we hit fast paths in heapam_visibility.c. */ builder->xmin = running->oldestRunningXid; diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 43110e57b6..cf93357997 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -1498,7 +1498,7 @@ GetMaxSnapshotSubxidCount(void) * information may not be available. If we find any overflowed subxid arrays, * we have to mark the snapshot's subxid data as overflowed, and extra work * *may* need to be done to determine what's running (see XidInMVCCSnapshot() - * in tqual.c). + * in heapam_visibility.c). * * We also update the following backend-global variables: * TransactionXmin: the oldest xmin of any snapshot in use in the diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index a962034753..6fc11f26f0 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -185,6 +185,7 @@ #include "postgres.h" +#include "access/heapam.h" #include "access/htup_details.h" #include "access/slru.h" #include "access/subtrans.h" @@ -202,7 +203,6 @@ #include "storage/procarray.h" #include "utils/rel.h" #include "utils/snapmgr.h" -#include "utils/tqual.h" /* Uncomment the next line to test the graceful degradation code. */ /* #define TEST_OLDSERXID */ diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 93399f811a..e1aa3d0044 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -30,6 +30,7 @@ #include "postgres.h" +#include "access/heapam.h" #include "access/htup_details.h" #include "access/sysattr.h" #include "access/table.h" @@ -57,7 +58,6 @@ #include "utils/rls.h" #include "utils/snapmgr.h" #include "utils/syscache.h" -#include "utils/tqual.h" /* ---------- diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index b9f698ef2c..16903c25f4 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -8,9 +8,9 @@ * When a tuple is updated or deleted, our standard time qualification rules * consider that it is *still valid* so long as we are in the same command, * ie, until the next CommandCounterIncrement() or transaction commit. - * (See utils/time/tqual.c, and note that system catalogs are generally - * scanned under the most current snapshot available, rather than the - * transaction snapshot.) At the command boundary, the old tuple stops + * (See acces/heap/heapam_visibility.c, and note that system catalogs are + * generally scanned under the most current snapshot available, rather than + * the transaction snapshot.) At the command boundary, the old tuple stops * being valid and the new version, if any, becomes valid. Therefore, * we cannot simply flush a tuple from the system caches during heap_update() * or heap_delete(). The tuple is still good at that point; what's more, diff --git a/src/backend/utils/time/Makefile b/src/backend/utils/time/Makefile index 5a6e6fa4c8..f17b1c5324 100644 --- a/src/backend/utils/time/Makefile +++ b/src/backend/utils/time/Makefile @@ -12,6 +12,6 @@ subdir = src/backend/utils/time top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global -OBJS = combocid.o tqual.o snapmgr.o +OBJS = combocid.o snapmgr.o include $(top_srcdir)/src/backend/common.mk diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 6a2489ede3..ab0879138f 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -60,6 +60,15 @@ typedef struct HeapUpdateFailureData CommandId cmax; } HeapUpdateFailureData; +/* Result codes for HeapTupleSatisfiesVacuum */ +typedef enum +{ + HEAPTUPLE_DEAD, /* tuple is dead and deletable */ + HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */ + HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */ + HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */ + HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */ +} HTSV_Result; /* ---------------- * function prototypes for heap access method @@ -178,4 +187,29 @@ extern Size SyncScanShmemSize(void); struct VacuumParams; extern void heap_vacuum_rel(Relation onerel, int options, struct VacuumParams *params, BufferAccessStrategy bstrategy); + +/* in heap/heapam_visibility.c */ +extern bool HeapTupleSatisfiesVisibility(HeapTuple stup, Snapshot snapshot, + Buffer buffer); +extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTuple stup, CommandId curcid, + Buffer buffer); +extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple stup, TransactionId OldestXmin, + Buffer buffer); +extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, + uint16 infomask, TransactionId xid); +extern bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple); +extern bool XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot); +extern bool HeapTupleIsSurelyDead(HeapTuple htup, TransactionId OldestXmin); + +/* + * To avoid leaking too much knowledge about reorderbuffer implementation + * details this is implemented in reorderbuffer.c not heapam_visibility.c + */ +struct HTAB; +extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data, + Snapshot snapshot, + HeapTuple htup, + Buffer buffer, + CommandId *cmin, CommandId *cmax); + #endif /* HEAPAM_H */ diff --git a/src/include/utils/snapshot.h b/src/include/utils/snapshot.h index 952307103f..e7ea5cf7b5 100644 --- a/src/include/utils/snapshot.h +++ b/src/include/utils/snapshot.h @@ -185,8 +185,7 @@ typedef struct SnapshotData } SnapshotData; /* - * Result codes for HeapTupleSatisfiesUpdate. This should really be in - * tqual.h, but we want to avoid including that file elsewhere. + * Result codes for HeapTupleSatisfiesUpdate. */ typedef enum { diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h deleted file mode 100644 index de8c799ea5..0000000000 --- a/src/include/utils/tqual.h +++ /dev/null @@ -1,56 +0,0 @@ -/*------------------------------------------------------------------------- - * - * tqual.h - * POSTGRES "time qualification" definitions, ie, tuple visibility rules. - * - * Should be moved/renamed... - vadim 07/28/98 - * - * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * src/include/utils/tqual.h - * - *------------------------------------------------------------------------- - */ -#ifndef TQUAL_H -#define TQUAL_H - -#include "utils/snapshot.h" - -extern bool HeapTupleSatisfiesVisibility(HeapTuple stup, Snapshot snapshot, - Buffer buffer); - -/* Result codes for HeapTupleSatisfiesVacuum */ -typedef enum -{ - HEAPTUPLE_DEAD, /* tuple is dead and deletable */ - HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */ - HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */ - HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */ - HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */ -} HTSV_Result; - -/* Special "satisfies" routines with different APIs */ -extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTuple htup, - CommandId curcid, Buffer buffer); -extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, - TransactionId OldestXmin, Buffer buffer); -extern bool HeapTupleIsSurelyDead(HeapTuple htup, - TransactionId OldestXmin); - -extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, - uint16 infomask, TransactionId xid); -extern bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple); - -/* - * To avoid leaking too much knowledge about reorderbuffer implementation - * details this is implemented in reorderbuffer.c not tqual.c. - */ -struct HTAB; -extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data, - Snapshot snapshot, - HeapTuple htup, - Buffer buffer, - CommandId *cmin, CommandId *cmax); - -#endif /* TQUAL_H */