Replication changes the set based operation on the source database to row-by-row changes on the target database. This is true for all replication based solutions.
SQL issued on the source database can change arbitrary number of rows. This is mined by Dbvisit Replicate as row-by-row changes, and the changes are applied at the target database as row-by-row changes, only affecting one row at a time.
The consequence is that the SQL issued at the apply database is not the same issued against mine – instead, each SQL updates/deletes/inserts exactly one row, applying just one change.
A conflict occurs when there is a potential for the data between the source and target databases to be out of sync. This is also referred to as data divergence.
If either one or more of the following are true, then a conflict is raised:
Notes:
To detect that the target data has changed independently of the source data, Dbvisit Replicates includes the changed or updated column in the where clause.
A SALES table has the following values on source and target (they are in sync):
PROD_ID | AMOUNT_RECEIVED |
---|---|
101 | 250 |
When the following SQL is issued on the source database:
|
The replicated SQL that is applied on the target database is as follows:
|
If in the meantime, another transaction on the target database had changed AMOUT_RECEIVED from 250 to another value (say 199), then the above update would affect zero rows and the conflict would occur. This is because the WHERE clause (AMOUNT_RECEIVED = 250) would not be satisfied.
This ensures that the user is notified and no previous data will be lost.