From b33829744cb191994ef9d1f5d604e57e64b19ea4 Mon Sep 17 00:00:00 2001 From: Steve Singer Date: Tue, 29 Oct 2013 16:28:50 -0400 Subject: [PATCH] Fix for Bug 321 Bug 273 was fixed by no longer having the event provider forced into the list of provider nodes. This caused bug 321 as a side effect slon is often adding then removing (connecting and disconnecting) providers for nodes that don't provide any real data. A node that isn't an origin for a subscription still might have rows in sl_log_script that need to be processed. We need to check some provider for sl_log_script changes. Since the sl_listen network for non-subscription providing nodes can have multiple li_provider nodes for a given li_origin/li_receiver we just make sure that ANY of those nodes is an estalished provider. We don't need it to be the event provider. If the provider in the list is too far behind we abort sync_event() pause and try again. We also need to check to see if the cluster configuration has been changed by another worker during this time. --- RELEASE | 9 +++++++++ src/slon/remote_worker.c | 26 ++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/RELEASE b/RELEASE index 0b35010..28d715e 100644 --- a/RELEASE +++ b/RELEASE @@ -4,8 +4,17 @@ - Bug 318 :: Fix to FAILOVER logic to avoid slon restart loop + - Bug 319 :: Fix for slon dereferencing NULL pointers on a disconnect + - Bug 320 :: Fix UPDATE FUNCTIONS so it adds sl_node.no_failed on a upgrade from slony version before 2.2.0 + + - Bug 321 :: Don't keep creating then disconnecting provider connections to + non provider nodes + + - Bug 322 :: Fix CLONE PREPARE so it avoids a race condition in processing the + event on remote nodes + * Slony-I 2.2 Release Notes ** Significant Changes diff --git a/src/slon/remote_worker.c b/src/slon/remote_worker.c index eea9057..e284a09 100644 --- a/src/slon/remote_worker.c +++ b/src/slon/remote_worker.c @@ -647,6 +647,12 @@ remoteWorkerThread_main(void *cdata) if ((rc = sched_msleep(node, seconds * 1000)) != SCHED_STATUS_OK) break; + if (curr_config != rtcfg_seq_get()) + { + adjust_provider_info(node, wd, false, -1); + curr_config = rtcfg_seq_get(); + } + } if (rc != SCHED_STATUS_OK) break; @@ -831,8 +837,11 @@ remoteWorkerThread_main(void *cdata) if (PQresultStatus(res) != PGRES_TUPLES_OK) { slon_log(SLON_ERROR, "remoteWorkerThread_%d error querying " - "last confirmed id for node %d in CLONE NODE\n", - node->no_id, no_id); + "last confirmed id for node %d in CLONE NODE " + "- %s %s\n", + node->no_id, no_id, + PQresultErrorMessage(res), + PQerrorMessage(local_dbconn)); slon_retry(); } if (PQntuples(res) != 0) @@ -3660,16 +3669,13 @@ sync_event(SlonNode * node, SlonConn * local_conn, } /* - * Make sure that we have the event provider in our provider list. + * If the provider list is empty, we need some provider + * */ - for (provider = wd->provider_head; provider; provider = provider->next) + if (wd->provider_head == NULL) { - if (provider->no_id == event->event_provider) - break; - } - if (provider == NULL) - { - adjust_provider_info(node, wd, false, event->event_provider); + + adjust_provider_info(node, wd, false, event->event_provider); } /* -- 1.7.10.4