[Bucardo-general] Possible race condition in onetimecopy ?
rainer.brestan at gmx.net
Thu Nov 24 08:48:27 UTC 2011
During checking of Bucardo.pm for little improvements in handling of target database restarts, I have found a possible race condition in the KID.
Maybe I am right, maybe wrong, thats why i am asking.
Sync type is pushdelta with onetimecopy=1 (Bucardo 4.4.6).
During execution of onetimecopy not zero, the KID copy the data from source to target with
COPY $S.$T TO STDOUT and
COPY $S.$T FROM STDIN
After this command has finished, it does a REINDEX if necessary.
After reindex, deletes older entries in bucardo_delta.
It does it with
DELETE FROM bucardo.bucardo_delta WHERE txntime <= now() ...
Here might be a possible race condition.
Assuming a client makes updates to the source table ($S.$T) between end of COPY command and the DELETE command.
The trigger applied on the source table will create a entry in bucardo_delta.
But the DELETE command will remove this entry from bucardo_delta and the affected rows from source table will not be in the target table.
The COPY command has not seen the update and pushdelta does not know anything about the change, because it is deleted from bucardo_delta.
Should the time in the DELETE command be compared to the time before start of COPY ?
Have I missed something else ?
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
More information about the Bucardo-general