summaryrefslogtreecommitdiff
path: root/src/include/pgxc/nodemgr.h
blob: 0c1dca7abec451fe8324271e3ae8c7f01c22ebea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*-------------------------------------------------------------------------
 *
 * nodemgr.h
 *  Routines for node management
 *
 *
 * Portions Copyright (c) 1996-2011  PostgreSQL Global Development Group
 * Portions Copyright (c) 2010-2012 Postgres-XC Development Group
 *
 * src/include/pgxc/nodemgr.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef NODEMGR_H
#define NODEMGR_H

#include "nodes/parsenodes.h"

#define PGXC_NODENAME_LENGTH	64

/* Compile time max limits on number of coordinators and datanodes */
#define MAX_COORDINATORS		64
#define MAX_DATANODES			256

/* GUC parameters, limit for number of nodes */
extern int 	MaxDataNodes;
extern int 	MaxCoords;
/* Global number of nodes */
extern int 	NumDataNodes;
extern int 	NumCoords;

/* Node definition */
typedef struct
{
	Oid 		nodeoid;
	NameData	nodename;
	NameData	nodehost;
	int			nodeport;
	bool		nodeisprimary;
	bool 		nodeispreferred;
	bool		nodeishealthy;
} NodeDefinition;

extern void NodeTablesShmemInit(void);
extern Size NodeTablesShmemSize(void);

extern void PgxcNodeListAndCount(void);
extern void PgxcNodeGetOids(Oid **coOids, Oid **dnOids,
							int *num_coords, int *num_dns,
							bool update_preferred);
extern void PgxcNodeGetHealthMap(Oid *coOids, Oid *dnOids,
				int *num_coords, int *num_dns, bool *coHealthMap,
				bool *dnHealthMap);
extern NodeDefinition *PgxcNodeGetDefinition(Oid node);
extern void PgxcNodeAlter(AlterNodeStmt *stmt);
extern void PgxcNodeCreate(CreateNodeStmt *stmt);
extern void PgxcNodeRemove(DropNodeStmt *stmt);
extern void PgxcNodeDnListHealth(List *nodeList, bool *dnhealth);
extern bool PgxcNodeUpdateHealth(Oid node, bool status);

#endif	/* NODEMGR_H */