<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1494093571661_28562">We have tested the patch, it fixed the issue.</div><div id="yui_3_16_0_ym19_1_1494093571661_28589"><br></div><div id="yui_3_16_0_ym19_1_1494093571661_28590">Thanks,<br>Cedric.<br></div><div id="yui_3_16_0_ym19_1_1494093571661_28540"><span></span></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> Le Samedi 15 avril 2017 2h33, Steve Singer &lt;steve@ssinger.info&gt; a écrit :<br></font></div>  <br><br> <div class="y_msg_container"><div dir="ltr">On 04/03/2017 04:27 PM, Perotto Cédric wrote:<br clear="none">&gt; Sorry for the wrong terminology, I was talking about 'Applciation<br clear="none">&gt; Events'&nbsp; (with the call stack slon-&gt;logApply-&gt;my_trigger-&gt;logTrigger and<br clear="none">&gt; the logTrigger not doing anything).<br clear="none">&gt;<br clear="none">&gt; Thanks for the quick answer and inform me when you have produced a patch.<br clear="none">&gt;<br clear="none">&gt; Cedric.<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none"><br clear="none">The attached pathces (0001 should be the same patch I sent out earlier, <br clear="none">0002 modifies it) should fix the issue.<br clear="none"><br clear="none">Let me know if it does.<div class="yqt4832070998" id="yqtfd83920"><br clear="none"><br clear="none"><br clear="none"><br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt; Le Lundi 3 avril 2017 21h57, Steve Singer &lt;<a shape="rect" ymailto="mailto:steve@ssinger.info" href="mailto:steve@ssinger.info">steve@ssinger.info</a>&gt; a écrit :<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt; On 04/03/2017 12:19 PM, Perotto Cédric wrote:<br clear="none">&gt;&nbsp; &gt; Hello and sorry for the direct emails but the bug tracker and the<br clear="none">&gt;&nbsp; &gt; mailing list @lists.slony.info appear to be down (mailer-daemon message<br clear="none">&gt;&nbsp; &gt; No mx record found for domain=lists.slony.info).<br clear="none">&gt;<br clear="none">&gt; The message did make it to the list<br clear="none">&gt; (<a shape="rect" href="http://lists.slony.info/pipermail/slony1-hackers/2017-April/000563.html" target="_blank">http://lists.slony.info/pipermail/slony1-hackers/2017-April/000563.html</a>).<br clear="none">&gt;&nbsp; &nbsp; Some of the mailing list issues might be related to yahoo and DMARC<br clear="none">&gt; issues. In the past other yahoo users have had issues.<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; So I expose directly my problem with Slony 2.2 again :<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; In my company we use Slony not only for replication but also as a queue<br clear="none">&gt;&nbsp; &gt; management system.<br clear="none">&gt;&nbsp; &gt; We implement tables representing event queues, each node is master on an<br clear="none">&gt;&nbsp; &gt; event queue to post messages.<br clear="none">&gt;&nbsp; &gt; We place triggers on the event queues which are activated only on slave<br clear="none">&gt;&nbsp; &gt; nodes (with a function checking the&nbsp; set_origin of the table and the<br clear="none">&gt;&nbsp; &gt; local node id).<br clear="none">&gt;&nbsp; &gt; In the trigger we change locally the session_replication_role (to<br clear="none">&gt;&nbsp; &gt; origin) to do updates in the target node (but only on master tables of<br clear="none">&gt;&nbsp; &gt; this node)<br clear="none">&gt;&nbsp; &gt; and get back&nbsp; the session_replication_role to replica at the end of the<br clear="none">&gt;&nbsp; &gt; trigger.<br clear="none">&gt;<br clear="none">&gt; I am a bit confused about your usage of the word 'event', for clarity<br clear="none">&gt; and so others aren't confused.<br clear="none">&gt;<br clear="none">&gt; For purposes of below I am going to qualify 'event' as either<br clear="none">&gt; 'Application Event' or 'Slony event'.<br clear="none">&gt;<br clear="none">&gt; When I say 'Slony event' I mean something corresponding to a row in<br clear="none">&gt; sl_event.<br clear="none">&gt;<br clear="none">&gt; By 'Application Event' I am refering to what I think your describing as<br clear="none">&gt; this:<br clear="none">&gt;<br clear="none">&gt; * You have a table that you have created named something like<br clear="none">&gt; 'myapp_event_queue'<br clear="none">&gt; * Your application does an 'INSERT INTO myapp_event_queue (....')<br clear="none">&gt; * On the replica you have a trigger that fires always on<br clear="none">&gt; myapp_event_queue.&nbsp; This trigger then changes session_replication_role<br clear="none">&gt; and does stuff<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt; I am of the opinion that the only way 'Slony events' should be created<br clear="none">&gt; is either from slonik or slon.&nbsp; I strongly discourage users from<br clear="none">&gt; calling the slony stored functions to create slony events outside of<br clear="none">&gt; slonik.&nbsp; I originally thought that this was what you were doing but now<br clear="none">&gt; I think maybe not.<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt; I think the issue here in this case might be that the call stack when<br clear="none">&gt; you replicate your 'Applciation Events' is<br clear="none">&gt;<br clear="none">&gt; slon-&gt;logApply-&gt;your_trigger-&gt;logTrigger<br clear="none">&gt;<br clear="none">&gt; The logTrigger is being called underneath the log apply.&nbsp; The log Apply<br clear="none">&gt; sets currentXid but doesn't initialize the variables needed by<br clear="none">&gt; logTrigger.&nbsp; What your doing should be safe and we can fix the<br clear="none">&gt; logTrigger to later initialize the plans.<br clear="none">&gt;<br clear="none">&gt; The potentially unsafe bits are when people generate their own 'Slony<br clear="none">&gt; events' in the same transaction as data.<br clear="none">&gt;<br clear="none">&gt; I'll try to produce a new patch later this week<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; That way data changed during the execution of the trigger should be<br clear="none">&gt;&nbsp; &gt; logged to slony (through the logTrigger) then replicated back to the<br clear="none">&gt;&nbsp; &gt; original node.<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; Everything was fine up to Slony 2.1 but the 2.2 version didn't work any<br clear="none">&gt;&nbsp; &gt; more.<br clear="none">&gt;&nbsp; &gt; The logTrigger was triggered during the logApply trigger but didn't do<br clear="none">&gt;&nbsp; &gt; any insertion in sl_log tables.<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; In src/backend/slony1_funcs.c, the cluster status doesn't have the<br clear="none">&gt;&nbsp; &gt; plan_insert_logs initialized in the context of the logApply trigger.<br clear="none">&gt;&nbsp; &gt; I tested the existence of plan_active_log to recreate it if needed in<br clear="none">&gt;&nbsp; &gt; the logTrigger C code, and apparently this works...<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; Is it a bug or a feature we used for years without any warranties ?<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; I can give you a full SQL example and the correction in slony1_funcs.c<br clear="none">&gt;&nbsp; &gt; if needed.<br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;&nbsp; &gt; Regards,<br clear="none">&gt;&nbsp; &gt; Cédric.</div><br clear="none">&gt;&nbsp; &gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt;<br clear="none">&gt; _______________________________________________<br clear="none">&gt; Slony1-hackers mailing list<br clear="none">&gt; <a shape="rect" ymailto="mailto:Slony1-hackers@lists.slony.info" href="mailto:Slony1-hackers@lists.slony.info">Slony1-hackers@lists.slony.info</a><br clear="none">&gt; <a shape="rect" href="http://lists.slony.info/mailman/listinfo/slony1-hackers" target="_blank">http://lists.slony.info/mailman/listinfo/slony1-hackers</a><div class="yqt4832070998" id="yqtfd38916"><br clear="none">&gt;<br clear="none"><br clear="none"></div></div><br><br></div>  </div> </div>  </div></div></body></html>