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

@@ -285,7 +285,7 @@ get_cluster_size(PGconn *conn)
* connection string is placed there.
*/
PGconn *
getMasterConnection(PGconn *standby_conn, char *schema, int id, char *cluster,
getMasterConnection(PGconn *standby_conn, char *schema, char *cluster,
int *master_id, char *master_conninfo_out)
{
PGconn *master_conn = NULL;
@@ -323,8 +323,8 @@ getMasterConnection(PGconn *standby_conn, char *schema, int id, char *cluster,
cluster);
sqlquery_snprintf(sqlquery, "SELECT id, conninfo FROM %s.repl_nodes "
" WHERE cluster = '%s' and id <> %d and not witness",
schema_quoted, cluster, id);
" WHERE cluster = '%s' and not witness",
schema_quoted, cluster);
res1 = PQexec(standby_conn, sqlquery);
if (PQresultStatus(res1) != PGRES_TUPLES_OK)