summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAndres Freund2019-01-22 01:03:15 +0000
committerAndres Freund2019-01-22 01:07:10 +0000
commitc91560defc57f89f7e88632ea14ae77b5cec78ee (patch)
tree250740f86c98f29eb20bdacf816ced13579c6a92 /src/include
parentb7eda3e0e33402a7727253e6f307ca96b92eb23d (diff)
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
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/heapam.h34
-rw-r--r--src/include/utils/snapshot.h3
-rw-r--r--src/include/utils/tqual.h56
3 files changed, 35 insertions, 58 deletions
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 */