[Bucardo-general] Replacing ontimecopy with cloning for b5
David E. Wheeler
david at justatheory.com
Tue Oct 15 17:02:43 UTC 2013
On Oct 14, 2013, at 7:57 PM, Greg Sabino Mullane <greg at endpoint.com> wrote:
> I've been pondering the "onetimecopy" functionality for Bucardo 5,
> and wanted to run my current idea past the list. I'm thinking of renaming
> it to minimize confusion - the current name is "clone", but I'm open to
> anything except "onetimecopy". :)
> The bucardo program will send a notification to the MCP, which will
> know to check this table for a new entry. (It also checks at a regular
> interval for queues entries). If it finds one, it kicks off a new CTL/KID
> to handle it. This KID is much simpler than others: it basically does a
> truncate on all the targets, followed by a simple COPY from the source
> to the targets.
It will also need to deactivate any other kids associated with the tables to be copied, and then re-activate them when it’s done.
> We need to keep the existing onetimecopy behavior regarding pre-populated
> tables in place. Right now, you can specify that onetimecopy only
> copy to tables that are empty. This is nice when you want to repopulate
> 1 of 3 targets in a sync, for example. However, the new syntax would
> also allow this to take place without that flag.
Does onetimecopy even work in the 5.0 branch?
> For more than one source, we'll simply assume that there is no overlap
> and the sources will copy to each other, but will not truncate. So
> for example, with databases A:source, B:source, and C:target, a
> clone command will do the following:
> C: TRUNCATE TABLE foo;
> A: COPY * FROM foo => B: COPY FROM STDIN
> A: COPY * FROM foo => C: COPY FROM STDIN
> B: COPY * FROM foo => A: COPY FROM STDIN
> B: COPY * FROM foo => C: COPY FROM STDIN
I don’t think that’s a good idea. If A and B are both sources, I would *expect* there to be a lot of overlap. A better choice, IMO, would be to require that only one source be used for the clone, and either truncate and clone only to targets, or optionally also truncate and clone to other sources.
More information about the Bucardo-general