index d8125f1ba2f51d64024435c65e36eaf2653d8a86..3282742b807b1014890398e6b3bf186f3beaf9f0 100644 (file)
#include "storage/smgr.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
PG_MODULE_MAGIC;
index 2cb3d1ca3bc8f4dd7052c73e787b1d985e787622..df2ad7f2c9d9725efd0805e8513f943c706abb3a 100644 (file)
#include "utils/builtins.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
#include "utils/varlena.h"
PG_MODULE_MAGIC;
index 4f449a26c153842904013db5b15f81612ef9c6aa..ff7c255a2de1fba9033ad8c88ac5cabc7f373c4d 100644 (file)
*/
#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);
index 8f67c3c2209b5d98811ae222c360c1fb98351a80..2ac9863463bdf8116af9bee18255c607aa162e3f 100644 (file)
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "utils/builtins.h"
-#include "utils/tqual.h"
#include "utils/varlena.h"
PG_MODULE_MAGIC;
index 7e7324a9166f330f2d87c44f27d6890f86ad2cdb..eae36fdbf40c63c4dde3c638e16271d9a6e9d2a6 100644 (file)
@@ -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
index dc2ff89d270846c861d763aabaf0166decfc8dd8..b9862247fb07af01823d29b07858cbffae0db935 100644 (file)
#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))
/*-------------------------------------------------------------------------
*
- * 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"
/*
index 2665f24730aeb9b868ad282c42c18b33debcc39b..a3e51922d85ef50493a2e5ffeeaecc4416a999bf 100644 (file)
#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
index f6b0f1b093335b47026330938d65f233ab127bcb..f5cf9ffc9c751d4a99a39d410d5e1d956c3a7e46 100644 (file)
#include "utils/memutils.h"
#include "utils/rel.h"
-#include "utils/tqual.h"
#include "storage/procarray.h"
index 6763fb920c2c0f326009ad255afc663b479ba00a..cd921a46005c411e401e3742d4d01e8749b2ed23 100644 (file)
#include "utils/rel.h"
#include "utils/snapmgr.h"
#include "utils/typcache.h"
-#include "utils/tqual.h"
#undef TOAST_DEBUG
index c09eb6eff885d9ad87ec2b41a6832f4516f1ea42..37aa484ec3a971f475de26ed843467a6390d2290 100644 (file)
#include "utils/memutils.h"
#include "utils/pg_rusage.h"
#include "utils/timestamp.h"
-#include "utils/tqual.h"
/*
index ffd79ffca7d13dd24a05cb76b0069a7599846f0c..e0a5ea42d525d2538ddea6cf8589de050a39ca4b 100644 (file)
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
-#include "utils/tqual.h"
/* ----------------------------------------------------------------
index ccb5ac402c83eb11882dfdeab1a32a59b2c1425f..b9311ce5950349c749b30781de96508664a3ea97 100644 (file)
@@ -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.
*/
index e55611ae09d511917391153244d384e2715cde10..365ddfb428fc6b2f62b1ac130769070f1f00ead3 100644 (file)
@@ -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.
index 18467d96d28003efb880d4a06a931f9e03c7019f..7c3a9c1e899a6a978b795efee710315cee7ed9ca 100644 (file)
@@ -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
index b6d472335fe8a568521c69cb5e9fa5dcf39f7d0e..7359600fd36303c709804ea797d9f221519dfcb9 100644 (file)
#include "utils/syscache.h"
#include "utils/tuplesort.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
/* Potentially set by pg_upgrade_support functions */
index 83625d10e7556be87b0bf05712e3089a0c68dd4b..c8192353ebe2643858ef9123a82c07c598523fc6 100644 (file)
#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 */
index 0099b8813780cfeee218d02f5cff61a754f78452..5a7ee0de4cfb51c440a121d467f6cf13262df117 100644 (file)
@@ -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
index 99e25cd50fb945fa21c3a016c804daacfd1f546c..5c0f238c7e264f1852b122a8aa7ade99908846b0 100644 (file)
#include "utils/relmapper.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
-#include "utils/tqual.h"
#include "utils/tuplesort.h"
index cd20abc141e5f7a32214969d9a085a153e49e592..5e74585d5e4d99a8a2737d796e072d404c55be59 100644 (file)
#include "utils/rel.h"
#include "utils/spccache.h"
#include "utils/snapmgr.h"
-#include "utils/tqual.h"
static TupleTableSlot *BitmapHeapNext(BitmapHeapScanState *node);
index 241711a81d773f2941e856519b14d71137bdec75..566858c19b35f2e6d0a82cf70df8d1512659770c 100644 (file)
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/rel.h"
-#include "utils/tqual.h"
static bool ExecOnConflictUpdate(ModifyTableState *mtstate,
index 7d4f17b4e99201f177d3d27dd8342cec072b1630..da4a65fd30ad99b65027ece482844f62f8b0ec91 100644 (file)
#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);
index b79ce5db958d0385bd26feb58c4f091908217b69..a49e226967c8ee824c80e44bd9007e56cfa0701f 100644 (file)
#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 */
@@ -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)
index 2310e9fafe0a083bfd4a8d4edba63758457db7e7..2f185f782395b125c90db2fd5cf292dbe4f69829 100644 (file)
@@ -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;
index 43110e57b681807127e8f28f72646f0212cccdc2..cf93357997c448215bfbc3afb3ff6659ce294120 100644 (file)
* 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
index a962034753b70f0c76b98096a4b3c91ecb25a6c1..6fc11f26f0eb3daf81fc98da540c815c9d9ca3ac 100644 (file)
#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 */
index 93399f811a5bbe8380c6efa76d58ad6140541272..e1aa3d0044f17461c3086a3c0d9724252665ef05 100644 (file)
#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"
/* ----------
index b9f698ef2cec5d00f5d3344555fc110138b2064e..16903c25f45fce14f5e3951c2ecdf40f5b6eaee7 100644 (file)
* 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,
index 5a6e6fa4c8e2186f2a5591997839d138707bd062..f17b1c5324968cbb5f58082048f51b32c3397669 100644 (file)
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
index 6a2489ede3cb8836b09223038da4a55a17ae9245..ab0879138f0de67b30c0cc130083cfbdfc5e576f 100644 (file)
@@ -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
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 */
index 952307103fc78a3d9dd28998948ffb3835369a00..e7ea5cf7b565a0224d74fc77a1c5486b5fa88717 100644 (file)
} 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
{
deleted file mode 100644
(file)
index
de8c799..0000000
+++ /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 */