View Issue Details

IDProjectCategoryView StatusLast Update
0005032SymmetricDSBugpublic2023-09-13 17:25
Reporterflow Assigned Topmarzullo  
Prioritynormal 
Status closedResolutionopen 
Product Version3.12.10 
Summary0005032: Conflict resolution : NEWER_WINS but source node never wins
DescriptionWhen a incoming row is received and a conflict is detected, the target node update the target table with the same data that are already in it (and add a row in the sym_data table). So the local time is always more recent than the remote time and the changes are never applied.
Steps To ReproduceGet two nodes out of sync
Update a row that will generate a conflict
Additional Information2021-06-15 16:02:19,025 DEBUG [SymmetricDS] [HttpTransportManager] [symmetricds-push-default-4] Building transport url: http://svinfotest1:31415/sync/push?nodeId=DEV1
2021-06-15 16:02:19,026 DEBUG [SymmetricDS] [DefaultDatabaseWriter] [symmetricds-dataloader-2] Preparing dml: update `base`.`agent` set `nomAgent` = ? where `nomAgent` = ? and `codeAgent` = ?
2021-06-15 16:02:19,026 DEBUG [SymmetricDS] [DefaultDatabaseWriter] [symmetricds-dataloader-2] Submitting data ['ETU', 'ETA', '01641'] with types [VARCHAR, VARCHAR, VARCHAR]
2021-06-15 16:02:19,027 DEBUG [SymmetricDS] [PushService] [symmetricds-push-default-4] Push completed for svserver1:central:central channel default
2021-06-15 16:02:19,028 DEBUG [SymmetricDS] [AbstractDatabaseWriterConflictResolver] [symmetricds-dataloader-2] Conflict detected: default in batch central-3708658 at line 1 for table base.agent
2021-06-15 16:02:19,028 DEBUG [SymmetricDS] [AbstractDatabaseWriterConflictResolver] [symmetricds-dataloader-2] Row data: "01641","ETU"
2021-06-15 16:02:19,028 DEBUG [SymmetricDS] [AbstractDatabaseWriterConflictResolver] [symmetricds-dataloader-2] Old data: "01641","ETA"
2021-06-15 16:02:19,029 DEBUG [SymmetricDS] [DefaultDatabaseWriterConflictResolver] [symmetricds-dataloader-2] Finding last capture time for table agent with pk of {01641}
2021-06-15 16:02:19,036 DEBUG [SymmetricDS] [DefaultDatabaseWriterConflictResolver] [symmetricds-dataloader-2] Losing row from batch central-3708658 with local time of 2021-06-15T16:02:19.000+0200 and remote time of 2021-06-15T16:00:32.000+0200 for table agent and pk of {01641}
Tagsconflict manager

Activities

flow

2021-06-15 19:33

reporter  

source.png (5,697 bytes)   
source.png (5,697 bytes)   
target.png (5,452 bytes)   
target.png (5,452 bytes)   

pmarzullo

2021-06-16 17:49

developer   ~0001957

If the source node of the changed row was updated more recently than the local row, then the source row will win the conflict. This is working as designed.

flow

2021-06-16 18:40

reporter   ~0001958

Yes, that's the point, but in my case, the target node win the conflict !
When the incoming row is received on the target node, a "useless" update seems to be executed on the target table (you can see the state of the sym_data table on target.png).
This update is obviously more recent than the source row and distorts the timestamp comparison.

flow

2021-06-17 08:25

reporter   ~0001959

Maybe I misundestood something.
To be more precise, the table base.agent is initially in the following state on each node :
--------------------------
Source
codeAgent : 01641
nomAgent : ETA
--------------------------
Target
codeAgent : 01641
nomAgent : ETO

I execute the following query on the source node :
Update base.agent set nomAgent = ‘ETU’ where codeAgent = ‘01641’ ;
A conflict is detected on the target node and the change is not applied.

pmarzullo

2022-12-08 19:34

developer   ~0002237

Here are the exact steps that I executed to show that the conflict resolution is correct.
Set up synchronization using H2 databases for both source and target.
If you use a different database, see how to disable data capture for your specific database:
https://support.jumpmind.com/kb/article/23-Disabling-Sync-Triggers-for-Session

1. Source node:
insert into agent (codeAgent, nomAgent) values('01641', 'ETA');
2. Allow the record to synch to the target
3. Target node:s
select * from agent; -- Make sure ETA is set as the nomAgent
4. Target node: set auto commit to false
5. Disable capturing data changes on the target node
Target node:
set @sync_prevented=1;
5. Update agent table record to ETO
Target node:
update agent set nomAgent='ETO' where codeAgent='01641';
6. Start capturing data changes on the target node
Target node:
set @sync_prevented=null;
7. Commit changes on target node
Target node:
commit;
8.Update agent on source node
update agent set nomAgent='ETU' where codeAgent='01641';
9. Wait for synchronization to target node
Target node:
select * from agent where nodeAgent='01641';

Target node will have nomAgent='ETU' for codeAgent='01641'

Issue History

Date Modified Username Field Change
2021-06-15 19:33 flow New Issue
2021-06-15 19:33 flow Tag Attached: conflict manager
2021-06-15 19:33 flow File Added: source.png
2021-06-15 19:33 flow File Added: target.png
2021-06-16 17:49 pmarzullo Note Added: 0001957
2021-06-16 17:51 pmarzullo Assigned To => pmarzullo
2021-06-16 17:51 pmarzullo Status new => feedback
2021-06-16 18:40 flow Note Added: 0001958
2021-06-16 18:40 flow Status feedback => assigned
2021-06-17 08:25 flow Note Added: 0001959
2022-12-08 19:34 pmarzullo Status assigned => feedback
2022-12-08 19:34 pmarzullo Note Added: 0002237
2023-09-13 17:25 emiller Status feedback => closed