diff options
| author | Michael P | 2011-10-27 01:57:30 +0000 |
|---|---|---|
| committer | Michael P | 2011-10-27 01:57:30 +0000 |
| commit | 56a90674444df1464c8e7012c6113efd7f9bc7db (patch) | |
| tree | 67b151ad250bad909d2cbf7e6a33b4d36632e2c3 /src/bin | |
| parent | ef4717fab54d11cbc4cf8b6607bee346fc99d85a (diff) | |
Support for Node and Node Group DDL
Node information is not anymore supported by node number using
GUC parameters but node names.
Node connection information is taken from a new catalog table
called pgxc_node. Node group information can be found in pgxc_group.
Node connection information is taken from catalog when user session
begins and sticks with it for the duration of the session. This brings
more flexibility to the cluster settings. Cluster node information can
now be set when node is initialized with initdb using cluster_nodes.sql
located in share directory.
This commits adds support for the following new DDL:
- CREATE NODE
- ALTER NODE
- DROP NODE
- CREATE NODE GROUP
- DROP NODE GROUP
The following parameters are deleted from postgresql.conf:
- num_data_nodes
- preferred_data_nodes
- data_node_hosts
- data_node_ports
- primary_data_node
- num_coordinators
- coordinator_hosts
- coordinator_ports
pgxc_node_id is replaced by pgxc_node_name to identify the node-self.
Documentation is added for the new queries. Functionalities such as
EXECUTE DIRECT, CLEAN CONNECTION use node names instead of node numbers now.
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/initdb/initdb.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index fd430d8528..5cd2cc3ee4 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -105,6 +105,9 @@ static char *dictionary_file; static char *info_schema_file; static char *features_file; static char *system_views_file; +#ifdef PGXC +static char *cluster_nodes_file; +#endif static bool made_new_pgdata = false; static bool found_existing_pgdata = false; static bool made_new_xlogdir = false; @@ -169,6 +172,9 @@ static void setup_auth(void); static void get_set_pwd(void); static void setup_depend(void); static void setup_sysviews(void); +#ifdef PGXC +static void setup_clusternodes(void); +#endif static void setup_description(void); static void setup_collation(void); static void setup_conversion(void); @@ -1463,6 +1469,46 @@ setup_sysviews(void) check_ok(); } +#ifdef PGXC +/* + * set up Postgres-XC cluster node catalog data + */ +static void +setup_clusternodes(void) +{ + PG_CMD_DECL; + char **line; + char **nodes_setup; + + fputs(_("creating cluster information ... "), stdout); + fflush(stdout); + + nodes_setup = readfile(cluster_nodes_file); + + /* + * We use -j here to avoid backslashing stuff in system_views.sql + */ + snprintf(cmd, sizeof(cmd), + "\"%s\" %s -j template1 >%s", + backend_exec, backend_options, + DEVNULL); + + PG_CMD_OPEN; + + for (line = nodes_setup; *line != NULL; line++) + { + PG_CMD_PUTS(*line); + free(*line); + } + + PG_CMD_CLOSE; + + free(nodes_setup); + + check_ok(); +} +#endif + /* * load description data */ @@ -2919,6 +2965,9 @@ main(int argc, char *argv[]) set_input(&info_schema_file, "information_schema.sql"); set_input(&features_file, "sql_features.txt"); set_input(&system_views_file, "system_views.sql"); +#ifdef PGXC + set_input(&cluster_nodes_file, "cluster_nodes.sql"); +#endif set_info_version(); @@ -2952,6 +3001,9 @@ main(int argc, char *argv[]) check_input(info_schema_file); check_input(features_file); check_input(system_views_file); +#ifdef PGXC + check_input(cluster_nodes_file); +#endif setlocales(); @@ -3275,6 +3327,10 @@ main(int argc, char *argv[]) setup_sysviews(); +#ifdef PGXC + setup_clusternodes(); +#endif + setup_description(); setup_collation(); |
