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:23:49 -05:00
parent 5d8cf6abe0
commit a55d7a4bd3
4 changed files with 11 additions and 13 deletions

View File

@@ -185,7 +185,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, local_options.node,
primaryConn = getMasterConnection(myLocalConn,
local_options.cluster_name,
&primary_options.node,NULL);
if (primaryConn == NULL)
@@ -269,7 +269,7 @@ MonitorExecute(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, local_options.node,
primaryConn = getMasterConnection(myLocalConn,
local_options.cluster_name, &primary_options.node,NULL);
if (PQstatus(primaryConn) == CONNECTION_OK)
{