Christopher Browne cbbrowne at ca.afilias.info
Tue Aug 17 08:18:37 PDT 2010
Scott Marlowe <scott.marlowe at gmail.com> writes:
> On Mon, Aug 16, 2010 at 10:24 AM, Christopher Browne
> <cbbrowne at ca.afilias.info> wrote:
>> Triggers on the table may still need to fire; they certainly did, on the
>> origin, and they may also need to, on subscribers.
>
> Aren't all triggers disabled on slaves in slony (except slony
> triggers) by default?

By default, yes.

But that's not the same thing as saying they *must* be disabled.

I know we (Afilias) have cases, normally for managing cached objects,
where we expressly add such triggers.

Note that in such cases, the old tuples, on the origin node, all get
wiped out in favor of new tuples which happen to have the same values as
the old tuples.

Example:

Foo is a table with 65536 tuples, none of them dead.

test at localhost->  update foo set id = id;
UPDATE 65536
test at localhost->  update foo set id = id;
UPDATE 65536
test at localhost->  update foo set id = id;
UPDATE 65536
test at localhost->  update foo set id = id;
UPDATE 65536
test at localhost->  vacuum verbose foo;
INFO:  vacuuming "public.foo"
INFO:  scanned index "foo_pkey" to remove 262056 row versions
DETAIL:  CPU 0.00s/0.02u sec elapsed 0.02 sec.
[more elided that's not terribly interesting]
INFO:  "foo": found 65564 removable, 65536 nonremovable row versions in 1450 out of 1450 pages
DETAIL:  0 dead row versions cannot be removed yet.
There were 40 unused item pointers.
0 pages are entirely empty.

The changes *actually got applied* to the original tuples on the origin
node.  Nothing to do with replication.  I don't see any huge problem in
this getting applied to subscribers.

It's definitely more work (from a coding perspective) to *not* log such
updates.  And if we were to do so, you'd lose the ability to decide to
use those updates for something (e.g. - cache management) on subscribers
without needing to do something to alter the source table on the origin.

There are legitimate arguments for both approaches.  I favour "just
apply the changes," which shouldn't simply quash dissent, but I'm
disinclined to change approaches, barring rather wider discussion of the
matter.
-- 
select 'cbbrowne' || '@' || 'ca.afilias.info';
Christopher Browne
"Bother,"  said Pooh,  "Eeyore, ready  two photon  torpedoes  and lock
phasers on the Heffalump, Piglet, meet me in transporter room three"


More information about the Slony1-general mailing list