[Bucardo-general] overlapping master/slave replication, and rules on the slave
josh at endpoint.com
Mon Mar 22 13:47:17 UTC 2010
On Mon, Mar 22, 2010 at 05:21:11PM +1100, Nick Farrell wrote:
> I've looked over the Bucardo documentation, and am not sure whether a
> particular configuration is supported. What would happen if I ran
> multiple instances of Bucardo, each one replicating a different remote
> database to a single central database?
> The scenario involves a layout where I know that each record in a table
> is 'owned' by one of the remote databases, but I'd like the changes
> replicated centrally.
> As only the slave is overlapping, I'm hoping there's no namespace
> collision, and the record-level updates will interleave smoothly. While
> I'm happy to go ahead and just try this out, I thought it worth finding
> out whether it was theoretically possible first.
If, given any particular table in your database, it is replicated from only
one master, you're fine. But if, for instance, you want to replicate table
"foo" from two different machines and merge those two tables together in your
slave, you may well run into problems. For instance, what if you had this:
CREATE TABLE foo (
id INTEGER PRIMARY KEY,
If you then run this on machine A:
INSERT INTO foo (id, data) VALUES (1, 'from machine A');
...and this on B:
INSERT INTO foo (id, data) VALUES (1, 'from machine B');
Bucardo would try to insert both rows into its copy of foo, and fail, because
it would violate the uniqueness constraint on the id column.
> And my second question:
> How are rules treated? I see that indexes are not propogated across -
> what happens with rules? I assume they are not copied across, and if
> COPY is being used to update the tables, I believe the rules will not be
> invoked. Am I correct?
Rules aren't copied from one database to another, just like schema changes.
However, if for instance you issue a query to update table foo, and a rule
changes that to updating table bar instead, Bucardo will update bar on the
replica. In other words, Bucardo replicates the actual data changed after all
triggers, rules, etc. have been applied.
Josh Tolley josh at endpoint.com 801-987-0252
End Point Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: Digital signature
Url : https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20100322/80652bea/attachment.bin
More information about the Bucardo-general