simon,

>This is normally resolved by logging the time each command was issued

Not "when it was issued" but when exactly it was finally commited. When 
one or more update statements are part of a transcation, you now have 
to use sqlite3_profile to log when exactly the transaction ended (i.e. 
can be considered actually stored). That implies both sqlite3_trace and 
sqlite3_profile need to be monitored to keep track of what constitutes 
an update transaction and when precisely it was commited.

If machines A and B (or more) run independantly, I don't believe you 
need a central "untouched" copy: you can very well carefully merge logs 
and determine for each machine what change took place after every of 
its own updates for every row in every table.

Another tough issue is how to re-sync machine times down to a very 
small time window in a common time frame. Whatever small "vulnerable" 
time window you achieve, you can be assured that it will cause in a 
problem someday, resulting in updates merged out of real-world order.

Note that merging can also violate constraints in the merged database. 
Say a rule (enforced by constraint or at applicative level) limits the 
number, volume or nature of the updates permitted in a given timeframe, 
you have no guarantee that this rule will be enforced if independant 
(albeit individually conformal) changes are made but only later merged. 
Several changes can very well have taken place independantly without 
breaking local rules (to the knowledge of the local machine), but 
discover only at merge time that some of the last operations would have 
been rejected if they have been submitted to a centralized machine/DB.

For instance you have an export restriction (available stock or 
manufacturing capability) which allows no more than N given items XYZ 
to be exported (or sold) per day/week/month. Even if independant 
machines+DBs don't violate the rule from their own point of view, the 
merged dataset may be in violation of the limit(s) or simply rejected 
by SQL constraints at merge time.

While I agree that this is not exactly in the realm of raw data merge 
in the right order, this still is a serious problem to deal with, not 
solvable with such simple merging operations. 

Reply via email to