Pass username to pg_basebackup

This commit is contained in:
Ian Barwick
2015-01-05 10:29:02 +09:00
parent 413cc6eb54
commit 4f37515113

View File

@@ -1890,10 +1890,11 @@ run_basebackup()
int r = 0; int r = 0;
maxlen_snprintf(script, maxlen_snprintf(script,
"%s/pg_basebackup -h %s -p %s -D %s -l \"repmgr base backup\" --write-recovery-conf", "%s/pg_basebackup -h %s -p %s -U %s -D %s -l \"repmgr base backup\" --write-recovery-conf",
options.pg_bindir, options.pg_bindir,
runtime_options.host, runtime_options.host,
runtime_options.masterport, runtime_options.masterport,
runtime_options.username,
runtime_options.dest_dir runtime_options.dest_dir
); );
log_info(_("Executing: '%s'\n"), script); log_info(_("Executing: '%s'\n"), script);
@@ -2364,7 +2365,7 @@ check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *
* *
* Perform sanity check on master configuration * Perform sanity check on master configuration
* *
* TODO: check replication connection is possbile * TODO: check replication connection is possble
*/ */
static bool static bool
check_master_config(PGconn *conn, bool exit_on_error) check_master_config(PGconn *conn, bool exit_on_error)
@@ -2373,7 +2374,8 @@ check_master_config(PGconn *conn, bool exit_on_error)
is_standby_retval; is_standby_retval;
bool config_ok = true; bool config_ok = true;
/* ZZZ check user is qualified to perform base backup */
/* Check we are cloning a primary node */ /* Check we are cloning a primary node */
is_standby_retval = is_standby(conn); is_standby_retval = is_standby(conn);
if (is_standby_retval) if (is_standby_retval)
@@ -2390,6 +2392,8 @@ check_master_config(PGconn *conn, bool exit_on_error)
config_ok = false; config_ok = false;
} }
/* XXX check user is qualified to perform base backup */
/* And check if it is well configured */ /* And check if it is well configured */
i = guc_set(conn, "wal_level", "=", "hot_standby"); i = guc_set(conn, "wal_level", "=", "hot_standby");
if (i == 0 || i == -1) if (i == 0 || i == -1)
@@ -2406,7 +2410,7 @@ check_master_config(PGconn *conn, bool exit_on_error)
config_ok = false; config_ok = false;
} }
/* ZZZ change this */ /* XXX we may need to modify this */
i = guc_set_typed(conn, "wal_keep_segments", ">=", i = guc_set_typed(conn, "wal_keep_segments", ">=",
runtime_options.wal_keep_segments, "integer"); runtime_options.wal_keep_segments, "integer");
if (i == 0 || i == -1) if (i == 0 || i == -1)