Whitespace to adjust for longer snprintf identifier

This is done in a separate patch to try and reduce the sound and fury
of the patch that actually did the conversion from sprintf to
snprintf-alikes.

Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
This commit is contained in:
Dan Farina
2010-12-07 21:37:56 -08:00
committed by Peter van Hardenberg
parent 916c0492fb
commit 84b69b3bd4
4 changed files with 85 additions and 68 deletions

View File

@@ -145,7 +145,8 @@ get_cluster_size(PGconn *conn)
const char *size; const char *size;
char sqlquery[QUERY_STR_LEN]; char sqlquery[QUERY_STR_LEN];
sqlquery_snprintf(sqlquery, sqlquery_snprintf(
sqlquery,
"SELECT pg_size_pretty(SUM(pg_database_size(oid))::bigint) " "SELECT pg_size_pretty(SUM(pg_database_size(oid))::bigint) "
" FROM pg_database "); " FROM pg_database ");

View File

@@ -519,7 +519,8 @@ do_standby_register(void)
} }
/* Check if there is a schema for this cluster */ /* Check if there is a schema for this cluster */
sqlquery_snprintf(sqlquery, "SELECT 1 FROM pg_namespace WHERE nspname = 'repmgr_%s'", sqlquery_snprintf(sqlquery,
"SELECT 1 FROM pg_namespace WHERE nspname = 'repmgr_%s'",
myClusterName); myClusterName);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
@@ -748,8 +749,13 @@ do_standby_clone(void)
if (verbose) if (verbose)
printf(_("Succesfully connected to primary. Current installation size is %s\n"), get_cluster_size(conn)); printf(_("Succesfully connected to primary. Current installation size is %s\n"), get_cluster_size(conn));
/* Check if the tablespace locations exists and that we can write to them */ /*
sqlquery_snprintf(sqlquery, "select spclocation from pg_tablespace where spcname not in ('pg_default', 'pg_global')"); * Check if the tablespace locations exists and that we can write to them.
*/
sqlquery_snprintf(sqlquery,
"SELECT spclocation "
" FROM pg_tablespace "
"WHERE spcname NOT IN ('pg_default', 'pg_global')");
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
@@ -824,9 +830,12 @@ do_standby_clone(void)
fprintf(stderr, "Starting backup...\n"); fprintf(stderr, "Starting backup...\n");
/* Get the data directory full path and the configuration files location */ /* Get the data directory full path and the configuration files location */
sqlquery_snprintf(sqlquery, "SELECT name, setting " sqlquery_snprintf(
sqlquery,
"SELECT name, setting "
" FROM pg_settings " " FROM pg_settings "
" WHERE name IN ('data_directory', 'config_file', 'hba_file', 'ident_file')"); " WHERE name IN ('data_directory', 'config_file', 'hba_file', "
" 'ident_file')");
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
@@ -854,7 +863,10 @@ do_standby_clone(void)
* inform the master we will start a backup and get the first XLog filename * inform the master we will start a backup and get the first XLog filename
* so we can say to the user we need those files * so we can say to the user we need those files
*/ */
sqlquery_snprintf(sqlquery, "SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld'))", time(NULL)); sqlquery_snprintf(
sqlquery,
"SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld'))",
time(NULL));
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
@@ -906,7 +918,10 @@ do_standby_clone(void)
* find and appropiate rsync option but besides we could someday make all * find and appropiate rsync option but besides we could someday make all
* these rsync happen concurrently * these rsync happen concurrently
*/ */
sqlquery_snprintf(sqlquery, "select spclocation from pg_tablespace where spcname not in ('pg_default', 'pg_global')"); sqlquery_snprintf(sqlquery,
"SELECT spclocation "
" FROM pg_tablespace "
" WHERE spcname NOT IN ('pg_default', 'pg_global')");
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {

View File

@@ -273,7 +273,8 @@ MonitorExecute(void)
CancelQuery(); CancelQuery();
/* Get local xlog info */ /* Get local xlog info */
sqlquery_snprintf(sqlquery, sqlquery_snprintf(
sqlquery,
"SELECT CURRENT_TIMESTAMP, pg_last_xlog_receive_location(), " "SELECT CURRENT_TIMESTAMP, pg_last_xlog_receive_location(), "
"pg_last_xlog_replay_location()"); "pg_last_xlog_replay_location()");