Update use of paranthesis in logging messages.

Extracted portion of what was originally
ceca9fa983c8dbde61a7a78da29a1e1871756d8c , due to be
applied later.
This commit is contained in:
Greg Smith
2011-06-07 00:19:11 -04:00
parent 620f8090a3
commit e52f2e88a5
3 changed files with 66 additions and 65 deletions

View File

@@ -18,8 +18,9 @@
*/ */
#include "config.h" #include "config.h"
#include "repmgr.h" #include "log.h"
#include "strutil.h" #include "strutil.h"
#include "repmgr.h"
void void
parse_config(const char* config_file, t_configuration_options* options) parse_config(const char* config_file, t_configuration_options* options)

106
repmgr.c
View File

@@ -289,8 +289,8 @@ main(int argc, char **argv)
{ {
if (options.node == -1) if (options.node == -1)
{ {
log_err("Node information is missing. " log_err(_("Node information is missing. "
"Check the configuration file.\n"); "Check the configuration file.\n"));
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
} }
@@ -372,7 +372,7 @@ do_master_register(void)
sqlquery_snprintf(sqlquery, sqlquery_snprintf(sqlquery,
"SELECT 1 FROM pg_namespace " "SELECT 1 FROM pg_namespace "
"WHERE nspname = '%s'", repmgr_schema); "WHERE nspname = '%s'", repmgr_schema);
log_debug("master register: %s\n", sqlquery); log_debug(_("master register: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
@@ -482,7 +482,7 @@ do_master_register(void)
sqlquery_snprintf(sqlquery, "DELETE FROM %s.repl_nodes " sqlquery_snprintf(sqlquery, "DELETE FROM %s.repl_nodes "
" WHERE id = %d", " WHERE id = %d",
repmgr_schema, options.node); repmgr_schema, options.node);
log_debug("master register: %s\n", sqlquery); log_debug(_("master register: %s\n"), sqlquery);
if (!PQexec(conn, sqlquery)) if (!PQexec(conn, sqlquery))
{ {
@@ -564,11 +564,11 @@ 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 = '%s'", repmgr_schema); sqlquery_snprintf(sqlquery, "SELECT 1 FROM pg_namespace WHERE nspname = '%s'", repmgr_schema);
log_debug("standby register: %s\n", sqlquery); log_debug(_("standby register: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("Can't get info about tablespaces: %s\n", PQerrorMessage(conn)); log_err(_("Can't get info about tablespaces: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -577,7 +577,7 @@ do_standby_register(void)
if (PQntuples(res) == 0) if (PQntuples(res) == 0)
{ {
/* schema doesn't exist */ /* schema doesn't exist */
log_err("Schema %s doesn't exists.\n", repmgr_schema); log_err(_("Schema %s doesn't exists.\n"), repmgr_schema);
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -622,11 +622,11 @@ do_standby_register(void)
sqlquery_snprintf(sqlquery, "DELETE FROM %s.repl_nodes " sqlquery_snprintf(sqlquery, "DELETE FROM %s.repl_nodes "
" WHERE id = %d", " WHERE id = %d",
repmgr_schema, options.node); repmgr_schema, options.node);
log_debug("standby register: %s\n", sqlquery); log_debug(_("standby register: %s\n"), sqlquery);
if (!PQexec(master_conn, sqlquery)) if (!PQexec(master_conn, sqlquery))
{ {
log_err("Cannot delete node details, %s\n", log_err(_("Cannot delete node details, %s\n"),
PQerrorMessage(master_conn)); PQerrorMessage(master_conn));
PQfinish(master_conn); PQfinish(master_conn);
PQfinish(conn); PQfinish(conn);
@@ -797,12 +797,12 @@ do_standby_clone(void)
"SELECT spclocation " "SELECT spclocation "
" FROM pg_tablespace " " FROM pg_tablespace "
"WHERE spcname NOT IN ('pg_default', 'pg_global')"); "WHERE spcname NOT IN ('pg_default', 'pg_global')");
log_debug("standby clone: %s\n", sqlquery); log_debug(_("standby clone: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("Can't get info about tablespaces: %s\n", PQerrorMessage(conn)); log_err(_("Can't get info about tablespaces: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -867,18 +867,18 @@ do_standby_clone(void)
goto stop_backup; goto stop_backup;
} }
log_notice("Starting backup...\n"); log_notice(_("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, sqlquery_snprintf(sqlquery,
"SELECT name, setting " "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')");
log_debug("standby clone: %s\n", sqlquery); log_debug(_("standby clone: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("Can't get info about data directory and configuration files: %s\n", PQerrorMessage(conn)); log_err(_("Can't get info about data directory and configuration files: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -906,11 +906,11 @@ do_standby_clone(void)
sqlquery, sqlquery,
"SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld'))", "SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld'))",
time(NULL)); time(NULL));
log_debug("standby clone: %s\n", sqlquery); log_debug(_("standby clone: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("Can't start backup: %s\n", PQerrorMessage(conn)); log_err(_("Can't start backup: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -952,21 +952,21 @@ do_standby_clone(void)
goto stop_backup; goto stop_backup;
} }
log_info("standby clone: master control file '%s'\n", master_control_file); log_info(_("standby clone: master control file '%s'\n"), master_control_file);
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, r = copy_remote_files(runtime_options.host, runtime_options.remote_user,
master_control_file, local_control_file, false); master_control_file, local_control_file, false);
if (r != 0) if (r != 0)
{ {
log_warning("standby clone: failed copying master control file '%s'\n", master_control_file); log_warning(_("standby clone: failed copying master control file '%s'\n"), master_control_file);
goto stop_backup; goto stop_backup;
} }
log_info("standby clone: master data directory '%s'\n", master_data_directory); log_info(_("standby clone: master data directory '%s'\n"), master_data_directory);
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, r = copy_remote_files(runtime_options.host, runtime_options.remote_user,
master_data_directory, runtime_options.dest_dir, true); master_data_directory, runtime_options.dest_dir, true);
if (r != 0) if (r != 0)
{ {
log_warning("standby clone: failed copying master data directory '%s'\n", master_data_directory); log_warning(_("standby clone: failed copying master data directory '%s'\n"), master_data_directory);
goto stop_backup; goto stop_backup;
} }
@@ -1022,7 +1022,7 @@ do_standby_clone(void)
master_ident_file, runtime_options.dest_dir, false); master_ident_file, runtime_options.dest_dir, false);
if (r != 0) if (r != 0)
{ {
log_warning("standby clone: failed copying master ident file '%s'\n", master_ident_file); log_warning(_("standby clone: failed copying master ident file '%s'\n"), master_ident_file);
goto stop_backup; goto stop_backup;
} }
@@ -1037,14 +1037,14 @@ stop_backup:
log_info(_("%s connecting to master database to stop backup\n"), progname); log_info(_("%s connecting to master database to stop backup\n"), progname);
conn=establishDBConnectionByParams(keywords,values,false); conn=establishDBConnectionByParams(keywords,values,false);
log_notice("Finishing backup...\n"); log_notice(_("Finishing backup...\n"));
sqlquery_snprintf(sqlquery, "SELECT pg_xlogfile_name(pg_stop_backup())"); sqlquery_snprintf(sqlquery, "SELECT pg_xlogfile_name(pg_stop_backup())");
log_debug("standby clone: %s\n", sqlquery); log_debug(_("standby clone: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("Can't stop backup: %s\n", PQerrorMessage(conn)); log_err(_("Can't stop backup: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_STOP_BACKUP); exit(ERR_STOP_BACKUP);
@@ -1129,7 +1129,7 @@ do_standby_promote(void)
/* Check we are in a standby node */ /* Check we are in a standby node */
if (!is_standby(conn)) if (!is_standby(conn))
{ {
log_err("repmgr: The command should be executed on a standby node\n"); log_err(_("%s: The command should be executed on a standby node\n"), progname);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
@@ -1139,7 +1139,7 @@ do_standby_promote(void)
if (old_master_conn != NULL) if (old_master_conn != NULL)
{ {
PQfinish(old_master_conn); PQfinish(old_master_conn);
log_err("There is a master already in this cluster\n"); log_err(_("There is a master already in this cluster\n"));
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
@@ -1148,11 +1148,11 @@ do_standby_promote(void)
/* Get the data directory full path and the last subdirectory */ /* Get the data directory full path and the last subdirectory */
sqlquery_snprintf(sqlquery, "SELECT setting " sqlquery_snprintf(sqlquery, "SELECT setting "
" FROM pg_settings WHERE name = 'data_directory'"); " FROM pg_settings WHERE name = 'data_directory'");
log_debug("standby promote: %s\n", sqlquery); log_debug(_("standby promote: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("Can't get info about data directory: %s\n", PQerrorMessage(conn)); log_err(_("Can't get info about data directory: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -1177,7 +1177,7 @@ do_standby_promote(void)
r = system(script); r = system(script);
if (r != 0) if (r != 0)
{ {
log_err("Can't restart PostgreSQL server\n"); log_err(_("Can't restart PostgreSQL server\n"));
exit(ERR_NO_RESTART); exit(ERR_NO_RESTART);
} }
@@ -1186,11 +1186,11 @@ do_standby_promote(void)
conn = establishDBConnection(options.conninfo, true); conn = establishDBConnection(options.conninfo, true);
if (is_standby(conn)) if (is_standby(conn))
{ {
log_err("\n%s: STANDBY PROMOTE failed, this is still a standby node.\n", progname); log_err(_("\n%s: STANDBY PROMOTE failed, this is still a standby node.\n"), progname);
} }
else else
{ {
log_err("\n%s: STANDBY PROMOTE successful. You should REINDEX any hash indexes you have.\n", progname); log_err(_("\n%s: STANDBY PROMOTE successful. You should REINDEX any hash indexes you have.\n"), progname);
} }
PQfinish(conn); PQfinish(conn);
return; return;
@@ -1222,7 +1222,7 @@ do_standby_follow(void)
log_info(_("%s connected to standby, checking its state\n"), progname); log_info(_("%s connected to standby, checking its state\n"), progname);
if (!is_standby(conn)) if (!is_standby(conn))
{ {
log_err("\n%s: The command should be executed in a standby node\n", progname); log_err(_("\n%s: The command should be executed in a standby node\n"), progname);
return; return;
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
@@ -1243,7 +1243,7 @@ do_standby_follow(void)
if (master_conn == NULL) if (master_conn == NULL)
{ {
PQfinish(conn); PQfinish(conn);
log_err("There isn't a master to follow in this cluster\n"); log_err(_("There isn't a master to follow in this cluster\n"));
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
@@ -1251,7 +1251,7 @@ do_standby_follow(void)
if (is_standby(master_conn)) if (is_standby(master_conn))
{ {
PQfinish(conn); PQfinish(conn);
log_err("%s: The node to follow should be a master\n", progname); log_err(_("%s: The node to follow should be a master\n"), progname);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
@@ -1290,11 +1290,11 @@ do_standby_follow(void)
/* Get the data directory full path */ /* Get the data directory full path */
sqlquery_snprintf(sqlquery, "SELECT setting " sqlquery_snprintf(sqlquery, "SELECT setting "
" FROM pg_settings WHERE name = 'data_directory'"); " FROM pg_settings WHERE name = 'data_directory'");
log_debug("standby follow: %s\n", sqlquery); log_debug(_("standby follow: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("Can't get info about data directory: %s\n", PQerrorMessage(conn)); log_err(_("Can't get info about data directory: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
PQfinish(conn); PQfinish(conn);
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -1313,7 +1313,7 @@ do_standby_follow(void)
r = system(script); r = system(script);
if (r != 0) if (r != 0)
{ {
log_err("Can't restart service\n"); log_err(_("Can't restart service\n"));
return; return;
exit(ERR_NO_RESTART); exit(ERR_NO_RESTART);
} }
@@ -1381,14 +1381,14 @@ create_recovery_file(const char *data_dir, char *master_conninfo)
recovery_file = fopen(recovery_file_path, "w"); recovery_file = fopen(recovery_file_path, "w");
if (recovery_file == NULL) if (recovery_file == NULL)
{ {
log_err("could not create recovery.conf file, it could be necessary to create it manually\n"); log_err(_("could not create recovery.conf file, it could be necessary to create it manually\n"));
return false; return false;
} }
maxlen_snprintf(line, "standby_mode = 'on'\n"); maxlen_snprintf(line, "standby_mode = 'on'\n");
if (fputs(line, recovery_file) == EOF) if (fputs(line, recovery_file) == EOF)
{ {
log_err("recovery file could not be written, it could be necessary to create it manually\n"); log_err(_("recovery file could not be written, it could be necessary to create it manually\n"));
fclose(recovery_file); fclose(recovery_file);
return false; return false;
} }
@@ -1431,7 +1431,7 @@ create_recovery_file(const char *data_dir, char *master_conninfo)
if (fputs(line, recovery_file) == EOF) if (fputs(line, recovery_file) == EOF)
{ {
log_err("recovery file could not be written, it could be necessary to create it manually\n"); log_err(_("recovery file could not be written, it could be necessary to create it manually\n"));
fclose(recovery_file); fclose(recovery_file);
return false; return false;
} }
@@ -1501,7 +1501,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
rsync_flags, host_string, remote_path, local_path); rsync_flags, host_string, remote_path, local_path);
} }
log_info("rsync command line: '%s'\n", script); log_info(_("rsync command line: '%s'\n"), script);
r = system(script); r = system(script);
@@ -1556,13 +1556,13 @@ check_parameters_for_action(const int action)
if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] || if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] ||
runtime_options.dbname[0]) runtime_options.dbname[0])
{ {
log_err("You can't use connection parameters to the master when issuing a MASTER REGISTER command.\n"); log_err(_("You can't use connection parameters to the master when issuing a MASTER REGISTER command.\n"));
usage(); usage();
ok = false; ok = false;
} }
if (runtime_options.dest_dir[0]) if (runtime_options.dest_dir[0])
{ {
log_err("You don't need a destination directory for MASTER REGISTER command\n"); log_err(_("You don't need a destination directory for MASTER REGISTER command\n"));
usage(); usage();
ok = false; ok = false;
} }
@@ -1576,13 +1576,13 @@ check_parameters_for_action(const int action)
if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] || if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] ||
runtime_options.dbname[0]) runtime_options.dbname[0])
{ {
log_err("You can't use connection parameters to the master when issuing a STANDBY REGISTER command.\n"); log_err(_("You can't use connection parameters to the master when issuing a STANDBY REGISTER command.\n"));
usage(); usage();
ok = false; ok = false;
} }
if (runtime_options.dest_dir[0]) if (runtime_options.dest_dir[0])
{ {
log_err("You don't need a destination directory for STANDBY REGISTER command\n"); log_err(_("You don't need a destination directory for STANDBY REGISTER command\n"));
usage(); usage();
ok = false; ok = false;
} }
@@ -1597,13 +1597,13 @@ check_parameters_for_action(const int action)
if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] || if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] ||
runtime_options.dbname[0]) runtime_options.dbname[0])
{ {
log_err("You can't use connection parameters to the master when issuing a STANDBY PROMOTE command.\n"); log_err(_("You can't use connection parameters to the master when issuing a STANDBY PROMOTE command.\n"));
usage(); usage();
ok = false; ok = false;
} }
if (runtime_options.dest_dir[0]) if (runtime_options.dest_dir[0])
{ {
log_err("You don't need a destination directory for STANDBY PROMOTE command\n"); log_err(_("You don't need a destination directory for STANDBY PROMOTE command\n"));
usage(); usage();
ok = false; ok = false;
} }
@@ -1618,13 +1618,13 @@ check_parameters_for_action(const int action)
if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] || if (runtime_options.host[0] || runtime_options.masterport[0] || runtime_options.username[0] ||
runtime_options.dbname[0]) runtime_options.dbname[0])
{ {
log_err("You can't use connection parameters to the master when issuing a STANDBY FOLLOW command.\n"); log_err(_("You can't use connection parameters to the master when issuing a STANDBY FOLLOW command.\n"));
usage(); usage();
ok = false; ok = false;
} }
if (runtime_options.dest_dir[0]) if (runtime_options.dest_dir[0])
{ {
log_err("You don't need a destination directory for STANDBY FOLLOW command\n"); log_err(_("You don't need a destination directory for STANDBY FOLLOW command\n"));
usage(); usage();
ok = false; ok = false;
} }
@@ -1637,10 +1637,10 @@ check_parameters_for_action(const int action)
*/ */
if (runtime_options.config_file[0]) if (runtime_options.config_file[0])
{ {
log_notice("Only command line parameters for the connection " log_notice(_("Only command line parameters for the connection "
"to the master are used when issuing a STANDBY CLONE command. " "to the master are used when issuing a STANDBY CLONE command. "
"The passed configuration file is neither required nor used for " "The passed configuration file is neither required nor used for "
"its node configuration portions\n\n"); "its node configuration portions\n\n"));
} }
/* /*
* To clone a master into a standby we need connection parameters * To clone a master into a standby we need connection parameters
@@ -1649,8 +1649,8 @@ check_parameters_for_action(const int action)
*/ */
if (runtime_options.host == NULL) if (runtime_options.host == NULL)
{ {
log_notice("You need to use connection parameters to " log_notice(_("You need to use connection parameters to "
"the master when issuing a STANDBY CLONE command."); "the master when issuing a STANDBY CLONE command."));
ok = false; ok = false;
} }
need_a_node = false; need_a_node = false;

View File

@@ -145,8 +145,8 @@ main(int argc, char **argv)
parse_config(config_file, &local_options); parse_config(config_file, &local_options);
if (local_options.node == -1) if (local_options.node == -1)
{ {
log_err("Node information is missing. " log_err(_("Node information is missing. "
"Check the configuration file, or provide one if you have not done so.\n"); "Check the configuration file, or provide one if you have not done so.\n"));
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
@@ -316,7 +316,7 @@ MonitorExecute(void)
res = PQexec(myLocalConn, sqlquery); res = PQexec(myLocalConn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("PQexec failed: %s\n", PQerrorMessage(myLocalConn)); log_err(_("PQexec failed: %s\n"), PQerrorMessage(myLocalConn));
PQclear(res); PQclear(res);
/* if there is any error just let it be and retry in next loop */ /* if there is any error just let it be and retry in next loop */
return; return;
@@ -333,7 +333,7 @@ MonitorExecute(void)
res = PQexec(primaryConn, sqlquery); res = PQexec(primaryConn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("PQexec failed: %s\n", PQerrorMessage(primaryConn)); log_err(_("PQexec failed: %s\n"), PQerrorMessage(primaryConn));
PQclear(res); PQclear(res);
return; return;
} }
@@ -365,7 +365,7 @@ MonitorExecute(void)
* will check the result next time we pause for a monitor step. * will check the result next time we pause for a monitor step.
*/ */
if (PQsendQuery(primaryConn, sqlquery) == 0) if (PQsendQuery(primaryConn, sqlquery) == 0)
log_warning("Query could not be sent to primary. %s\n", log_warning(_("Query could not be sent to primary. %s\n"),
PQerrorMessage(primaryConn)); PQerrorMessage(primaryConn));
} }
@@ -383,7 +383,7 @@ checkClusterConfiguration(PGconn *conn, PGconn *primary)
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("PQexec failed: %s\n", PQerrorMessage(conn)); log_err(_("PQexec failed: %s\n"), PQerrorMessage(conn));
PQclear(res); PQclear(res);
CloseConnections(); CloseConnections();
exit(ERR_DB_QUERY); exit(ERR_DB_QUERY);
@@ -398,7 +398,7 @@ checkClusterConfiguration(PGconn *conn, PGconn *primary)
*/ */
if (PQntuples(res) == 0) if (PQntuples(res) == 0)
{ {
log_err("The replication cluster is not configured\n"); log_err(_("The replication cluster is not configured\n"));
PQclear(res); PQclear(res);
CloseConnections(); CloseConnections();
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -425,7 +425,7 @@ checkNodeConfiguration(char *conninfo)
res = PQexec(myLocalConn, sqlquery); res = PQexec(myLocalConn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
log_err("PQexec failed: %s\n", PQerrorMessage(myLocalConn)); log_err(_("PQexec failed: %s\n"), PQerrorMessage(myLocalConn));
PQclear(res); PQclear(res);
CloseConnections(); CloseConnections();
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -450,7 +450,7 @@ checkNodeConfiguration(char *conninfo)
if (!PQexec(primaryConn, sqlquery)) if (!PQexec(primaryConn, sqlquery))
{ {
log_err("Cannot insert node details, %s\n", log_err(_("Cannot insert node details, %s\n"),
PQerrorMessage(primaryConn)); PQerrorMessage(primaryConn));
CloseConnections(); CloseConnections();
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
@@ -468,7 +468,7 @@ walLocationToBytes(char *wal_location)
if (sscanf(wal_location, "%X/%X", &xlogid, &xrecoff) != 2) if (sscanf(wal_location, "%X/%X", &xlogid, &xrecoff) != 2)
{ {
log_err("wrong log location format: %s\n", wal_location); log_err(_("wrong log location format: %s\n"), wal_location);
return 0; return 0;
} }
return (( (long long) xlogid * 16 * 1024 * 1024 * 255) + xrecoff); return (( (long long) xlogid * 16 * 1024 * 1024 * 255) + xrecoff);
@@ -520,7 +520,7 @@ CancelQuery(void)
pgcancel = PQgetCancel(primaryConn); pgcancel = PQgetCancel(primaryConn);
if (!pgcancel || PQcancel(pgcancel, errbuf, ERRBUFF_SIZE) == 0) if (!pgcancel || PQcancel(pgcancel, errbuf, ERRBUFF_SIZE) == 0)
log_warning("Can't stop current query: %s\n", errbuf); log_warning(_("Can't stop current query: %s\n"), errbuf);
PQfreeCancel(pgcancel); PQfreeCancel(pgcancel);
} }