From: Steve Singer Date: Mon, 27 Oct 2014 21:01:29 +0000 (-0400) Subject: Bug 354 X-Git-Url: http://git.postgresql.org/gitweb/%7B?a=commitdiff_plain;h=798d55e1f74a150cac89d5d6dfefff0dd8020058;p=slony1-engine.git Bug 354 The RebuildListenEntries for a failed node that provides no subscriptions deletes all listen entries from that node. The remaining nodes might still need to listen for these events if the failover target has them. Otherwise the FAILOVER_NODE event will wait for this event but it will never come. Leave in the listen paths for failed nodes that don't provide any sets --- diff --git a/src/backend/slony1_funcs.sql b/src/backend/slony1_funcs.sql index e83c911e..378b4c72 100644 --- a/src/backend/slony1_funcs.sql +++ b/src/backend/slony1_funcs.sql @@ -4995,6 +4995,7 @@ returns int as $$ declare v_row record; + v_cnt integer; begin -- ---- -- Grab the central configuration lock @@ -5084,8 +5085,8 @@ begin end if; end if; - if v_row.failed then - + if v_row.failed then + --for every failed node we delete all sl_listen entries --except via providers (listed in sl_subscribe) --or failover candidates (sl_failover_targets) @@ -5093,7 +5094,17 @@ begin --that is more ahead of the failover candidate from --sending events to the failover candidate that --are 'too far ahead' - delete from @NAMESPACE@.sl_listen where + + --if the failed node is not an origin for any + --node then we don't delete all listen paths + --for events from it. Instead we leave + --the listen network alone. + + select count(*) into v_cnt from @NAMESPACE@.sl_subscribe sub, + @NAMESPACE@.sl_set s + where s.set_origin=v_row.origin and s.set_id=sub.sub_set; + if v_cnt > 0 then + delete from @NAMESPACE@.sl_listen where li_origin=v_row.origin and li_receiver=v_row.receiver and li_provider not in @@ -5102,7 +5113,8 @@ begin @NAMESPACE@.sl_set where sub_set=set_id and set_origin=v_row.origin); - end if; + end if; + end if; -- insert into @NAMESPACE@.sl_listen -- (li_origin,li_provider,li_receiver) -- SELECT v_row.origin, pa_server