[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slony1-general
Subject:    Re: [Slony1-general] How is replication of TRIGGERS handled under
From:       Steve Singer <ssinger_pg () sympatico ! ca>
Date:       2011-06-26 12:29:39
Message-ID: BLU0-SMTP41A46EE8695ABDB6277FE9AC540 () phx ! gbl
[Download RAW message or body]

Aleksey Tsalolikhin wrote:
> Hi.  I've been using Slony for a couple of years, and it's been working great;
> but we've just started using triggers in our application, and when I manually
> added the trigger on the subscriber side, next time I tried to recreate the
> data set, it wouldn't go due to multiple triggers issue.  So how do I replicate
> triggers, please?

Did you attempt to add the trigger (or make any other DDL change) on the 
subscriber outside of an EXECUTE SCRIPT block?

In 1.2.x slony munges the catalog (pg_class) to disable triggers on the 
subscriber nodes.

The comments another poster gave you about ENABLE/DISALBE triggers 
applies  to Slony 2.0 but might not work as you want for 1.2

My understanding of a procedure for running triggers on the master with 
1.2 is that you

1. You write a SQL script that adds the triggers to the tables via 
EXECUTE SCRIPT.
2.  That script will then run on all nodes.
3.  When you insert data into your table your trigger will run along 
with the slony triggers.
4.  When slony replicates the data to the slave this trigger will NOT 
run (and nor will the slony trigger) becaues pg_class on the slave was 
munged by slony to prevent triggers from running.

If you want your trigger to also run on the slave you can accomplish 
this in 1.2 with the SET ADD TRIGGER command.

If you tried to add a trigger to a slave without using EXECUTE SCRIPT 
(in 1.2) you might have corrupted your slave.

This is all different in 2.0,  I would recommend also looking at how 2.0 
  deals with this stuff and start planning an upgrade.

> 
> -----------------------------------------------------------------------------------------------------
>  
> This is the issue I ran into after manually adding the trigger on the
> subscriber:
> 
> 
> NOTICE: Slony-I: alterTableForReplication(): multiple instances of
> trigger % on table %'',
> 
> This normally happens if you have a table that had a trigger attached
> to it that replication hid due to this being a subscriber node, and
> then you added a trigger by the same name back to replication. Now,
> when trying to "fix up" triggers, those two triggers conflict.
> 
> The DDL script will keep running and rerunning, or the UNINSTALL NODE
> will keep failing, until you drop the "visible" trigger, by hand, much
> as you must have added it, by hand, earlier.
> 
> ERROR: Slony-I: Unable to disable triggers
> 
> This is the error that follows the "multiple triggers" problem.
> ------------------------------------------------------------------------------------------------------------
>  
> Should I have added the trigger to replication using slonik?  If so,
> how, please?  I looked
> on the slony.info web site but did not find the answer.
> 
> I am using slony1-1.2.21
> 
> Thanks,
> Aleksey
> _______________________________________________
> Slony1-general mailing list
> Slony1-general@lists.slony.info
> http://lists.slony.info/mailman/listinfo/slony1-general
> 
> 

_______________________________________________
Slony1-general mailing list
Slony1-general@lists.slony.info
http://lists.slony.info/mailman/listinfo/slony1-general


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic