lolusab
lolusab

Reputation: 11

SymmetricDS update error duplicate key

I use SymetricDS and sometimes symmetric raise an error :

INFO  [slave] [DefaultDatabaseWriter] [slave-data-loader-1] Failed to process update event in batch 298578.
ERROR [slave] [DataLoaderService]     [slave-data-loader-1] Failed to load batch 000-298578 StackTraceKey [UniqueKeyException:4114584735]
ERROR [master][AcknowledgeService]  [master-push-default-5] The outgoing batch 001-298578 failed: ERREUR: la valeur d'une clé dupliquée rompt la contrainte unique « primary_key_constaint_name » Détail : La clé existe déjà.

I have tried to detect and correct conflicts by insert in sym_conflict this row :

insert into sym_conflict(conflict_id, source_node_group_id, target_node_group_id, detect_type resolve_type, ping_back)
values('master-win', 'master', 'slave', 'USE_CHANGED_DATA', 'INGORE', 'SINGLE_ROW');

but this not working. On documentation have found this :

USE_CHANGED_DATA : Indicates that the primary key plus any data that has changed on the source system will be used to detect a conflict. If a row exists with the same old values on the target system as they were on the source system for the columns that have changed on the source system, then no conflict is detected during an update or a delete. If a row already exists during an insert then a conflict has been detected.

How symmetric can detect PK conflicts on a update and ignore it ? Thanks.

Upvotes: 1

Views: 828

Answers (1)

Boris Pavlović
Boris Pavlović

Reputation: 64632

No conflict detection, neither resolution is required in such cases. By default symmetricDs on insert if there's already a row with the same primary key on the target node will fall back to update and vice versa for an update falling back to an insert: http://www.symmetricds.org/doc/3.6/user-guide/html-single/user-guide.html#d4e104

Upvotes: 2

Related Questions