From: Craig Ringer Date: Tue, 13 Oct 2015 04:26:28 +0000 (+0800) Subject: Ignore bdr.bdr_connections rows where node is dropped X-Git-Url: http://git.postgresql.org/gitweb/static/session/%7B%7Bsession.id%7D%7D-%7B%7Bsession.title%7Cslugify%7D%7D?a=commitdiff_plain;h=509848ae99b66420e7dab13df5fb4623a8a59ab6;p=2ndquadrant_bdr.git Ignore bdr.bdr_connections rows where node is dropped If a node has been dropped or the entry in bdr.bdr_nodes for it has been deleted we should ignore the node when connecting to peers. Failure to do so causes issues with joining new nodes after a node is removed. Fixes #97 Fixes #50 Fixes #126 --- diff --git a/bdr_catalogs.c b/bdr_catalogs.c index fc54287f25..a4be19d6a9 100644 --- a/bdr_catalogs.c +++ b/bdr_catalogs.c @@ -355,6 +355,11 @@ bdr_fetch_node_id_via_sysid(uint64 sysid, TimeLineID tli, Oid dboid) * If both an entry with conn_origin for this node and one with null * conn_origin are found, only the one specific to this node is returned, * as it takes precedence over any generic configuration entry. + * + * Connections for nodes with state 'k'illed are not returned. + * Connections in other states are, since we should fail (and retry) + * until they're ready to accept slot creation. Connections with + * no corresponding bdr.bdr_nodes row also get ignored. */ List* bdr_read_connection_configs() @@ -389,12 +394,17 @@ bdr_read_connection_configs() " conn_is_unidirectional, " " conn_origin_dboid <> 0 AS origin_is_my_id " "FROM bdr.bdr_connections " + "INNER JOIN bdr.bdr_nodes " + " ON (conn_sysid = node_sysid AND " + " conn_timeline = node_timeline AND " + " conn_dboid = node_dboid) " "WHERE (conn_origin_sysid = '0' " " AND conn_origin_timeline = 0 " " AND conn_origin_dboid = 0) " " OR (conn_origin_sysid = $1 " " AND conn_origin_timeline = $2 " " AND conn_origin_dboid = $3) " + " AND node_status <> 'k' " "ORDER BY conn_sysid, conn_timeline, conn_dboid, " " conn_origin_sysid ASC NULLS LAST, " " conn_timeline ASC NULLS LAST, "