Subject Re: [firebird-support] Replicator pseudo-code (sorry, it's a little long...)
Author Milan Babuskov
Nigel Weeks wrote:
> Each database that mod_repl hooks into MUST HAVE
> int_siteid INTEGER NOT NULL,
> dtm_rstamp TIMESTAMP DEFAULT 'now',
> ...
> in every table.

Why timestamp?
What happens if time on server is changed?
How do you sinc the servers?

My suggestion is to use generators, actually a single generator.

> Change log tables have to be produced for each table in the database,
> Each log table has the all the fields of the table, and the GMT of the
> change(timezone independent)

Same here.

> ------ Begin Pseudo ------
> The 'Collector' queries each database, and retrieves any new changes.

How do you plan on doing this?
You can have a single one column table with one value: last replicated
generator_id. Then just query each table if it has gen_id larger than
that number.

Other things seem ok. Except one thing. It doesn't support conflicting
updates. I define "conflicting updates" like this:

At server A record X is changed to value y.
At server B record X is changed to value z.

When B receives updates from A, it could detect that it also has changed
record X since the last replication, and if the values are different
(A.new_x != B.new_x) it should issue the warning.

Well, just my ideas.


Milan Babuskov