#include "storage/smgr.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
PG_MODULE_MAGIC;
#include "utils/builtins.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
#include "utils/varlena.h"
PG_MODULE_MAGIC;
*/
#include "postgres.h"
+#include "access/heapam.h"
#include "access/relation.h"
#include "access/transam.h"
#include "access/visibilitymap.h"
#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);
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "utils/builtins.h"
-#include "utils/tqual.h"
#include "utils/varlena.h"
PG_MODULE_MAGIC;
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
#include "utils/lsyscache.h"
#include "utils/relcache.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
/* GUC variable */
/*
* 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))
{
*
* 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))
/*-------------------------------------------------------------------------
*
- * 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
* 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"
#include "utils/builtins.h"
#include "utils/combocid.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
/*
#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
#include "utils/memutils.h"
#include "utils/rel.h"
-#include "utils/tqual.h"
#include "storage/procarray.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
#include "utils/typcache.h"
-#include "utils/tqual.h"
#undef TOAST_DEBUG
#include "utils/memutils.h"
#include "utils/pg_rusage.h"
#include "utils/timestamp.h"
-#include "utils/tqual.h"
/*
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
-#include "utils/tqual.h"
/* ----------------------------------------------------------------
* 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.
*/
* (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.
* 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
#include "utils/syscache.h"
#include "utils/tuplesort.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
/* Potentially set by pg_upgrade_support functions */
#include <math.h>
#include "access/genam.h"
+#include "access/heapam.h"
#include "access/multixact.h"
#include "access/relation.h"
#include "access/sysattr.h"
#include "utils/sortsupport.h"
#include "utils/syscache.h"
#include "utils/timestamp.h"
-#include "utils/tqual.h"
/* Per-index data for ANALYZE */
* 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
#include "utils/relmapper.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
-#include "utils/tqual.h"
#include "utils/tuplesort.h"
#include "utils/rel.h"
#include "utils/spccache.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
static TupleTableSlot *BitmapHeapNext(BitmapHeapScanState *node);
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/rel.h"
-#include "utils/tqual.h"
static bool ExecOnConflictUpdate(ModifyTableState *mtstate,
#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);
#include <unistd.h>
#include <sys/stat.h>
+#include "access/heapam.h"
#include "access/rewriteheap.h"
#include "access/transam.h"
#include "access/tuptoaster.h"
#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 */
/*
* 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)
* 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;
* 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
#include "postgres.h"
+#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/slru.h"
#include "access/subtrans.h"
#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 */
#include "postgres.h"
+#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "utils/rls.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
-#include "utils/tqual.h"
/* ----------
* 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,
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
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
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 */
} 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
{
+++ /dev/null
-/*-------------------------------------------------------------------------
- *
- * 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 */