do not exit in get_cluster_size

This commit is contained in:
Christian Kruse
2014-01-16 15:04:31 +01:00
parent 6f149ead8f
commit 192ee3cdb0
2 changed files with 11 additions and 6 deletions

View File

@@ -280,7 +280,7 @@ const char *
get_cluster_size(PGconn *conn) get_cluster_size(PGconn *conn)
{ {
PGresult *res; PGresult *res;
const char *size; const char *size = NULL;
char sqlquery[QUERY_STR_LEN]; char sqlquery[QUERY_STR_LEN];
sqlquery_snprintf( sqlquery_snprintf(
@@ -293,11 +293,12 @@ get_cluster_size(PGconn *conn)
{ {
log_err(_("Get cluster size PQexec failed: %s"), log_err(_("Get cluster size PQexec failed: %s"),
PQerrorMessage(conn)); PQerrorMessage(conn));
PQclear(res);
PQfinish(conn);
exit(ERR_DB_QUERY);
} }
size = PQgetvalue(res, 0, 0); else
{
size = PQgetvalue(res, 0, 0);
}
PQclear(res); PQclear(res);
return size; return size;
} }

View File

@@ -779,6 +779,7 @@ do_standby_clone(void)
PGconn *conn; PGconn *conn;
PGresult *res; PGresult *res;
char sqlquery[QUERY_STR_LEN], *ret; char sqlquery[QUERY_STR_LEN], *ret;
const char *cluster_size;
int r = 0, retval = SUCCESS; int r = 0, retval = SUCCESS;
int i, is_standby_retval; int i, is_standby_retval;
@@ -980,7 +981,10 @@ do_standby_clone(void)
} }
PQclear(res); PQclear(res);
log_info(_("Successfully connected to primary. Current installation size is %s\n"), get_cluster_size(conn)); cluster_size = get_cluster_size(conn);
if (cluster_size == NULL)
exit(ERR_DB_QUERY);
log_info(_("Successfully connected to primary. Current installation size is %s\n"), cluster_size);
/* /*
* XXX master_xlog_directory should be discovered from master configuration * XXX master_xlog_directory should be discovered from master configuration