summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAndres Freund2019-01-14 23:54:18 +0000
committerAndres Freund2019-01-15 00:24:41 +0000
commit4c850ecec649c1b1538c741b89cf65d8f7d61853 (patch)
tree616cd9ae1c2e1dd8e6d38de606e7133235964437 /src/include
parent42e2a580713201645d7caa4b27713ac777432d8d (diff)
Don't include heapam.h from others headers.
heapam.h previously was included in a number of widely used headers (e.g. execnodes.h, indirectly in executor.h, ...). That's problematic on its own, as heapam.h contains a lot of low-level details that don't need to be exposed that widely, but becomes more problematic with the upcoming introduction of pluggable table storage - it seems inappropriate for heapam.h to be included that widely afterwards. heapam.h was largely only included in other headers to get the HeapScanDesc typedef (which was defined in heapam.h, even though HeapScanDescData is defined in relscan.h). The better solution here seems to be to just use the underlying struct (forward declared where necessary). Similar for BulkInsertState. Another problem was that LockTupleMode was used in executor.h - parts of the file tried to cope without heapam.h, but due to the fact that it indirectly included it, several subsequent violations of that goal were not not noticed. We could just reuse the approach of declaring parameters as int, but it seems nicer to move LockTupleMode to lockoptions.h - that's not a perfect location, but also doesn't seem bad. As a number of files relied on implicitly included heapam.h, a significant number of files grew an explicit include. It's quite probably that a few external projects will need to do the same. Author: Andres Freund Reviewed-By: Alvaro Herrera Discussion: https://postgr.es/m/20190114000701.y4ttcb74jpskkcfb@alap3.anarazel.de
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/heapam.h15
-rw-r--r--src/include/access/hio.h3
-rw-r--r--src/include/access/relscan.h5
-rw-r--r--src/include/catalog/index.h4
-rw-r--r--src/include/executor/executor.h7
-rw-r--r--src/include/nodes/execnodes.h3
-rw-r--r--src/include/nodes/lockoptions.h15
7 files changed, 25 insertions, 27 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 17ab75fd3d6..cf2ac151241 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -33,21 +33,6 @@
typedef struct BulkInsertStateData *BulkInsertState;
-/*
- * Possible lock modes for a tuple.
- */
-typedef enum LockTupleMode
-{
- /* SELECT FOR KEY SHARE */
- LockTupleKeyShare,
- /* SELECT FOR SHARE */
- LockTupleShare,
- /* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */
- LockTupleNoKeyExclusive,
- /* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */
- LockTupleExclusive
-} LockTupleMode;
-
#define MaxLockTupleMode LockTupleExclusive
/*
diff --git a/src/include/access/hio.h b/src/include/access/hio.h
index 84174766b98..cec087cb1a5 100644
--- a/src/include/access/hio.h
+++ b/src/include/access/hio.h
@@ -14,7 +14,6 @@
#ifndef HIO_H
#define HIO_H
-#include "access/heapam.h"
#include "access/htup.h"
#include "utils/relcache.h"
#include "storage/buf.h"
@@ -39,7 +38,7 @@ extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
HeapTuple tuple, bool token);
extern Buffer RelationGetBufferForTuple(Relation relation, Size len,
Buffer otherBuffer, int options,
- BulkInsertState bistate,
+ BulkInsertStateData *bistate,
Buffer *vmbuffer, Buffer *vmbuffer_other);
#endif /* HIO_H */
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
index 7bd32e18524..43a2286c172 100644
--- a/src/include/access/relscan.h
+++ b/src/include/access/relscan.h
@@ -15,7 +15,6 @@
#define RELSCAN_H
#include "access/genam.h"
-#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/itup.h"
#include "access/tupdesc.h"
@@ -71,7 +70,7 @@ typedef struct HeapScanDescData
BlockNumber rs_cblock; /* current block # in scan, if any */
Buffer rs_cbuf; /* current buffer in scan, if any */
/* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
- ParallelHeapScanDesc rs_parallel; /* parallel scan information */
+ struct ParallelHeapScanDescData *rs_parallel; /* parallel scan information */
/* these fields only used in page-at-a-time mode and for bitmap scans */
int rs_cindex; /* current tuple's index in vistuples */
@@ -155,7 +154,7 @@ typedef struct SysScanDescData
{
Relation heap_rel; /* catalog being scanned */
Relation irel; /* NULL if doing heap scan */
- HeapScanDesc scan; /* only valid in heap-scan case */
+ struct HeapScanDescData *scan; /* only valid in heap-scan case */
IndexScanDesc iscan; /* only valid in index-scan case */
Snapshot snapshot; /* snapshot to unregister at end of scan */
} SysScanDescData;
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index 0f1f63b38e8..8daac5663cd 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -117,7 +117,7 @@ extern double IndexBuildHeapScan(Relation heapRelation,
bool allow_sync,
IndexBuildCallback callback,
void *callback_state,
- HeapScanDesc scan);
+ struct HeapScanDescData *scan);
extern double IndexBuildHeapRangeScan(Relation heapRelation,
Relation indexRelation,
IndexInfo *indexInfo,
@@ -127,7 +127,7 @@ extern double IndexBuildHeapRangeScan(Relation heapRelation,
BlockNumber end_blockno,
IndexBuildCallback callback,
void *callback_state,
- HeapScanDesc scan);
+ struct HeapScanDescData *scan);
extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot);
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 50a943b6183..3831cceedfa 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -15,6 +15,7 @@
#define EXECUTOR_H
#include "executor/execdesc.h"
+#include "nodes/lockoptions.h"
#include "nodes/parsenodes.h"
#include "utils/memutils.h"
@@ -184,11 +185,11 @@ extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo);
extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok);
extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist);
extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate,
- Relation relation, Index rti, int lockmode,
+ Relation relation, Index rti, LockTupleMode lockmode,
ItemPointer tid, TransactionId priorXmax);
extern HeapTuple EvalPlanQualFetch(EState *estate, Relation relation,
- int lockmode, LockWaitPolicy wait_policy, ItemPointer tid,
- TransactionId priorXmax);
+ LockTupleMode lockmode, LockWaitPolicy wait_policy,
+ ItemPointer tid, TransactionId priorXmax);
extern void EvalPlanQualInit(EPQState *epqstate, EState *estate,
Plan *subplan, List *auxrowmarks, int epqParam);
extern void EvalPlanQualSetPlan(EPQState *epqstate,
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index a93bb61bf51..57031654900 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -15,7 +15,6 @@
#define EXECNODES_H
#include "access/genam.h"
-#include "access/heapam.h"
#include "access/tupconvert.h"
#include "executor/instrument.h"
#include "lib/pairingheap.h"
@@ -1268,7 +1267,7 @@ typedef struct ScanState
{
PlanState ps; /* its first field is NodeTag */
Relation ss_currentRelation;
- HeapScanDesc ss_currentScanDesc;
+ struct HeapScanDescData *ss_currentScanDesc;
TupleTableSlot *ss_ScanTupleSlot;
} ScanState;
diff --git a/src/include/nodes/lockoptions.h b/src/include/nodes/lockoptions.h
index c293595ccb8..8e8ccff43ca 100644
--- a/src/include/nodes/lockoptions.h
+++ b/src/include/nodes/lockoptions.h
@@ -43,4 +43,19 @@ typedef enum LockWaitPolicy
LockWaitError
} LockWaitPolicy;
+/*
+ * Possible lock modes for a tuple.
+ */
+typedef enum LockTupleMode
+{
+ /* SELECT FOR KEY SHARE */
+ LockTupleKeyShare,
+ /* SELECT FOR SHARE */
+ LockTupleShare,
+ /* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */
+ LockTupleNoKeyExclusive,
+ /* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */
+ LockTupleExclusive
+} LockTupleMode;
+
#endif /* LOCKOPTIONS_H */