summaryrefslogtreecommitdiff
path: root/src/bin/initdb
diff options
context:
space:
mode:
authorTomas Vondra2017-01-09 21:45:34 +0000
committerTomas Vondra2017-01-09 21:49:26 +0000
commitcfd481f6c3bac4c13ae653a378f8385bd5138c9f (patch)
tree0bd2246683378cd25cfc4723d46fe74c66cf8019 /src/bin/initdb
parent695d5ba977f5f78faa2e0cafd04401a5978196e5 (diff)
fix various minor bugs in initdb, to make it work
1) setup_nodeself() was starting it's own postgres process, which then conflicted with the already running one. Instead just pass the 'cmdfd' as for the other setup_* methods. 2) make_template0() included VACUUM command with a single '\n' at the end of the line, resulting in this error: FATAL: VACUUM cannot be executed from a function or multi-command string Apparently, there need to be '\n\n' as in the non-XL code.
Diffstat (limited to 'src/bin/initdb')
-rw-r--r--src/bin/initdb/initdb.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 3580c15543..df3561cc66 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -269,7 +269,7 @@ static void get_set_pwd(FILE *cmdfd);
static void setup_depend(FILE *cmdfd);
static void setup_sysviews(FILE *cmdfd);
#ifdef PGXC
-static void setup_nodeself(void);
+static void setup_nodeself(FILE *cmdfd);
#endif
static void setup_description(FILE *cmdfd);
static void setup_collation(FILE *cmdfd);
@@ -1747,26 +1747,13 @@ setup_sysviews(FILE *cmdfd)
* which is the node currently initialized.
*/
static void
-setup_nodeself(void)
+setup_nodeself(FILE *cmdfd)
{
- PG_CMD_DECL;
-
fputs(_("creating cluster information ... "), stdout);
fflush(stdout);
- snprintf(cmd, sizeof(cmd),
- "\"%s\" %s template1 >%s",
- backend_exec, backend_options,
- DEVNULL);
-
- PG_CMD_OPEN;
-
PG_CMD_PRINTF1("CREATE NODE %s WITH (type = 'coordinator');\n",
nodename);
-
- PG_CMD_CLOSE;
-
- check_ok();
}
#endif
@@ -2345,11 +2332,8 @@ make_template0(FILE *cmdfd)
/*
* Finally vacuum to clean up dead rows in pg_database
*/
-#ifdef XCP
- "VACUUM pg_catalog.pg_database;\n",
-#else
- "VACUUM pg_database;\n\n",
-#endif
+ "VACUUM pg_catalog.pg_database;\n\n",
+
NULL
};
@@ -3394,7 +3378,7 @@ initialize_data_directory(void)
#ifdef PGXC
/* Initialize catalog information about the node self */
- setup_nodeself();
+ setup_nodeself(cmdfd);
#endif
setup_description(cmdfd);