getMasterConnection() cannot avoid checking the same node that asks

to find the master.
This was a micro optimization based on the fact that all commands that
needed to detect the master were executed from the standby but now that
we have CLUSTER level commands that is not true anymore
This commit is contained in:
Jaime Casanova
2012-06-12 23:28:24 -05:00
parent 4db046a8ea
commit 7a76f1998c
4 changed files with 10 additions and 10 deletions

View File

@@ -257,7 +257,7 @@ main(int argc, char **argv)
/* I need the id of the primary as well as a connection to it */
log_info(_("%s Connecting to primary for cluster '%s'\n"),
progname, local_options.cluster_name);
primaryConn = getMasterConnection(myLocalConn, repmgr_schema, local_options.node,
primaryConn = getMasterConnection(myLocalConn, repmgr_schema,
local_options.cluster_name,
&primary_options.node, NULL);
if (primaryConn == NULL)
@@ -428,7 +428,7 @@ StandbyMonitor(void)
log_err(_("We couldn't reconnect to master. Now checking if another node has been promoted.\n"));
for (connection_retries = 0; connection_retries < 6; connection_retries++)
{
primaryConn = getMasterConnection(myLocalConn, repmgr_schema, local_options.node,
primaryConn = getMasterConnection(myLocalConn, repmgr_schema,
local_options.cluster_name, &primary_options.node, NULL);
if (PQstatus(primaryConn) == CONNECTION_OK)
{