Skip to content

Commit 18167f8

Browse files
committed
Check for PostgreSQL 9.5.4 ver, more comments
1 parent 4e5e2fb commit 18167f8

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/pathman.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,12 @@
2727
#include "parser/parsetree.h"
2828

2929

30-
/* Check PostgreSQL version */
31-
/*
32-
* TODO: a fix for WaitForBackgroundWorkerShutdown()
33-
* has been accepted, so we have to update this number.
34-
*/
35-
#if PG_VERSION_NUM < 90503
36-
#error "Cannot build pg_pathman with PostgreSQL version lower than 9.5.3"
30+
/* Check PostgreSQL version (9.5.4 contains an important fix for BGW) */
31+
#if PG_VERSION_NUM < 90504
32+
#error "Cannot build pg_pathman with PostgreSQL version lower than 9.5.4"
3733
#endif
3834

39-
/* Print Datum as CString to server log */
35+
/* Get CString representation of Datum (simple wrapper) */
4036
#ifdef USE_ASSERT_CHECKING
4137
#include "utils.h"
4238
#define DebugPrintDatum(datum, typid) ( datum_to_cstring((datum), (typid)) )
@@ -59,8 +55,14 @@
5955
/* type modifier (typmod) for 'range_interval' */
6056
#define PATHMAN_CONFIG_interval_typmod -1
6157

58+
/*
59+
* Cache current PATHMAN_CONFIG relid (set during load_config()).
60+
*/
6261
extern Oid pathman_config_relid;
6362

63+
/*
64+
* Just to clarify our intentions (returns pathman_config_relid).
65+
*/
6466
Oid get_pathman_config_relid(void);
6567

6668

@@ -72,10 +74,12 @@ typedef struct PathmanState
7274
LWLock *dsm_init_lock,
7375
*load_config_lock,
7476
*edit_partitions_lock;
75-
DsmArray databases;
7677
} PathmanState;
7778

7879

80+
/*
81+
* Result of search_range_partition_eq().
82+
*/
7983
typedef enum
8084
{
8185
SEARCH_RANGEREL_OUT_OF_RANGE = 0,
@@ -115,7 +119,6 @@ extern PathmanState *pmstate;
115119
} while (0)
116120

117121

118-
/* utility functions */
119122
int append_child_relation(PlannerInfo *root, RelOptInfo *rel, Index rti,
120123
RangeTblEntry *rte, int index, Oid childOID, List *wrappers);
121124

@@ -140,25 +143,22 @@ void set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, Index rti,
140143

141144
typedef struct
142145
{
143-
const Node *orig;
144-
List *args;
145-
List *rangeset;
146-
bool found_gap;
147-
double paramsel;
146+
const Node *orig; /* examined expression */
147+
List *args; /* extracted from 'orig' */
148+
List *rangeset; /* IndexRanges representing selected parts */
149+
bool found_gap; /* were there any gaps? */
150+
double paramsel; /* estimated selectivity */
148151
} WrapperNode;
149152

150153
typedef struct
151154
{
152-
/* Main partitioning structure */
153-
const PartRelationInfo *prel;
154-
155+
const PartRelationInfo *prel; /* main partitioning structure */
155156
ExprContext *econtext; /* for ExecEvalExpr() */
156-
157157
bool for_insert; /* are we in PartitionFilter now? */
158158
} WalkerContext;
159159

160160
/*
161-
* Usual initialization procedure for WalkerContext
161+
* Usual initialization procedure for WalkerContext.
162162
*/
163163
#define InitWalkerContext(context, prel_info, ecxt, for_ins) \
164164
do { \
@@ -184,6 +184,7 @@ void select_range_partitions(const Datum value,
184184
const int strategy,
185185
WrapperNode *result);
186186

187+
/* Examine expression in order to select partitions. */
187188
WrapperNode *walk_expr_tree(Expr *expr, WalkerContext *context);
188189

189190
#endif /* PATHMAN_H */

0 commit comments

Comments
 (0)