Quantcast
Viewing latest article 14
Browse Latest Browse All 4054

Peer-to-peer replication not staying in sync

We have set up a simple test of peer-to-peer replication with three nodes, A, B, and C.   Node A has the peer originator ID set to 100, node B is set to 90, and node C is set to 80.  Allow peer-to-peer conflict detection is set to true and continue replication after conflict detection is also set to true.  From these settings I would assume if node A and node B updated the same row at the same time, the values of node A would prevail.  But this isn't happening.

I have a table called HoursData that has three columns.  The first column is SysID which is a uniqueidentifier and the primary key.  The second column is named Hours and is numeric(8,2).  The third column is named  UpdatedBy and is varchar(30).  There is a single row in the table that contains this data:

SysID: E66AA9B0-7B73-4884-BFCE-7BDF688770BF     Hours: 10     UpdatedBy:  Smith

If I run this query on node A:
  Update HoursData Set Hours = 20, UpdatedBy = 'Smith' Where SysID = E66AA9B0-7B73-4884-BFCE-7BDF688770BF    

And at the same time run this query on node B:
  Update HoursData Set Hours = 30, UpdatedBy = 'Jones' Where SysID = E66AA9B0-7B73-4884-BFCE-7BDF688770BF    

I find that the following data is shown for each node:

Node A:  SysID: E66AA9B0-7B73-4884-BFCE-7BDF688770BF     Hours: 20     UpdatedBy:  Smith
Node B:  SysID: E66AA9B0-7B73-4884-BFCE-7BDF688770BF     Hours: 20     UpdatedBy:  Jones

As expected the hours for node B changed from 30 to 20 because node A has a higher peer originator ID.  However the UpdatedBy column did not revert to Smith.  The data is out of sync.  From what I can tell the issue is that the value for the UpdatedBy column did not change on node A.  This is not what I would expect to occur.  If I run the following on both servers at the same time"

Node A:
  Begin Transaction
    Update HoursData set UpdatedBy = ''
    Update HoursData Set Hours = 20, UpdatedBy = 'Smith' Where SysID = E66AA9B0-7B73-4884-BFCE-7BDF688770BF    
  Commit Transaction

Node B:
  Begin Transaction
    Update HoursData set UpdatedBy = ''
    Update HoursData Set Hours = 30, UpdatedBy = 'Jones' Where SysID = E66AA9B0-7B73-4884-BFCE-7BDF688770BF    
  Commit Transaction

The data looks like this as I would expect it to:

Node A:  SysID: E66AA9B0-7B73-4884-BFCE-7BDF688770BF     Hours: 20     UpdatedBy:  Smith
Node B:  SysID: E66AA9B0-7B73-4884-BFCE-7BDF688770BF     Hours: 20     UpdatedBy:  Smith

Is this the way peer-to-peer replication is designed to work where if a column value remains the same it doesn't change to the value from the higher originator ID?  This doesn't make much sense to me.


Viewing latest article 14
Browse Latest Browse All 4054

Trending Articles