dimanche 22 mars 2015

How to move data between two DB safely

I have two database A, B.


A record of A will move to B after being processed.


the below is simple procedure.


get A-record from A -> process A-record for B-record -> write B-record into B.


In above process, After writing record-B into B, the A-record in a A have to be removed.


And i Think for consistency, two action writing B-record into B and removing A-record from A have to be processed and committed at once.


Because, for example


After writing B-record but not removing record-A, the program shut down, So two database have no consistency.


So a record-A will be processed again.


And the other way, if i remove A-record first, and the program shut down before writing B-record, the A-record will is lost.


How to do usually in this case ?


Aucun commentaire:

Enregistrer un commentaire