Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Custom Two-way Synchronization?

forums forums SQLyog Using SQLyog Custom Two-way Synchronization?

  • This topic is empty.
Viewing 0 reply threads
  • Author
    Posts
    • #35386
      peterlaursen
      Participant

      What you have observed is per design.  And I/we have replied the same many times here already. 

       

      Data Sync uses the Primary Key of every table to identify if rows are identical or not.  If the value of the Primary Key for a specific row is the same they are considered identical and source will overwrite target for that row. That is the purpose of the Primary Key in relational databases really: it is a unique identification of a row of data. 

       

      Consequently, if you want to INSERT randomly to both databases between sync jobs, you will have to define the Primary Key in such a way that the same PK-value is not created on both source and target.  There are at least two ways to do this:

      1) Configure servers to use auto_increment_increment and auto_increment_offset values so that (for instance) *odd* PK-values are created on one server and *even* values on the other (this requires that the Primary Key is an integer, of course, and can be difficult to do if you already have data that need to be reindexed asitmay break Foreign keys to do so). auto_increment_increment and auto_increment_offset options are available in MySQL for use with master-master replication primarily, but work equally well with data sync. The scenarios are also quite similar.

      2) Add a ‘dummy’ column to every table with different default value on both servers and add this ‘dummy’ column to the Primary Key.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.