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

problem with the data synchronisation

forums forums SQLyog Sync tools, Migration, Scheduled Backup and Notifications problem with the data synchronisation

  • This topic is empty.
Viewing 7 reply threads
  • Author
    Posts
    • #9058
      aurelien
      Member

      Hello.

      I'm a french training.

      I execute data synchronisation between 2 servers MySQL.

      I see a problem :

      The all rows are not synchronisate.

      Exemple:

      Code:
      `enquetrices`                 1600     1593         0        0  No change  
      `enquetrices`                 1593     1600         0        0  No change  

      I don't understand why 7 rows are not synchronisate!

      This problem is dangerous for my project!

      Help please

      Thank you

    • #18192
      peterlaursen
      Participant

      probably it is a problem with the Primary Key that you are using.

      There is a bug with version 4.06 (should be fixed in 4.07 development tree) that generates exactly this error if the PK is a text-of-some-type-field containing the “”character. thus, For instance you cant use a field containg a windows' filename as a PK.

      What is the PK of the tables in tour case ??

    • #18193
      aurelien
      Member

      This is an exemple of the structure of a table.

      Code:
      /*Column Information For – animatrices-14-06-05.tva*/
      —————————————————–

      Field       Type         Collation          Null    Key     Default            Extra           Privileges                       Comment
      ———-  ———–  —————–  ——  ——  —————–  ————–  ——————————-  ——-
      serveur_id  varchar(20)  latin1_swedish_ci          PRI     serveur                            select,insert,update,references        
      num         int(11)      NULL                       PRI     (NULL)             auto_increment  select,insert,update,references        
      tva         double       NULL               YES             0                                  select,insert,update,references        
      date        date         NULL               YES             (NULL)                             select,insert,update,references        
      ts          timestamp    NULL               YES             CURRENT_TIMESTAMP                  select,insert,update,references        

      /*Index Information For – animatrices-14-06-05.tva*/
      —————————————————-

      Table   Non_unique  Key_name  Seq_in_index  Column_name  Collation  Cardinality  Sub_part  Packed  Null    Index_type  Comment
      ——  ———-  ——–  ————  ———–  ———  ———–  ——–  ——  ——  ———-  ——-
      tva              0  PRIMARY              1  serveur_id   A                    1    (NULL)  (NULL)          BTREE              
      tva              0  PRIMARY              2  num          A                    1    (NULL)  (NULL)          BTREE              
      tva              1  num                  1  num          A                    1    (NULL)  (NULL)          BTREE              

      /*DDL Information For – animatrices-14-06-05.tva*/
      ————————————————–

      Table   Create Table                                                                                                                                                                                                                                                                                                                                                
      ——  ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————-
      tva     CREATE TABLE `tva` (                                                                                                                                                                                                                                                                                                                                        
               `serveur_id` varchar(20) NOT NULL default 'serveur',                                                                                                                                                                                                                                                                                                      
               `num` int(11) NOT NULL auto_increment,                                                                                                                                                                                                                                                                                                                    
               `tva` double default '0',                                                                                                                                                                                                                                                                                                                                  
               `date` date default NULL,                                                                                                                                                                                                                                                                                                                                  
               `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,                                                                                                                                                                                                                                                                            
               PRIMARY KEY  (`serveur_id`,`num`),                                                                                                                                                                                                                                                                                                                        
               KEY `num` (`num`)                                                                                                                                                                                                                                                                                                                                          
             ) ENGINE=InnoDB DEFAULT CHARSET=latin1                                                                                                                                                                                                                                                                                                                      

      The PK is a combinate key. It compose of 2 field, a varchar type and an integer type.

      I'm available to yours other questions.

    • #18194
      peterlaursen
      Participant

      It works here! I tried both with and without HTTP-tunnelling on MySQL 5.07. I used your table definition and a few rows of data entered from the keyboard. SJA will both INSERT, UPDATE and DELETE as it should. I tried one-way and two-way sync as well.

      two questions:

      1) You are sure that there are no “”-characters in the “serveur_id” field anywhere ? Or any other character having a special meaning with MySQL such as ” ' ” .

      2) What is the

      Code:

      (yes or no?) in the job-file and do you use any SQL_WHERE ?

      If not believe there might be some problems with your data!

      further I note that:

      This PK definition

      “PRIMARY KEY (`serveur_id`,`num`),” is unusual – most often you would have the number field first.

      You could try reverting with an ALTER TABLE-statement like PRIMARY KEY (`num`,`serveur_id`)

      (There is something special with the MySQL server when using an autoincrement integer in conjunction with another field as a PK. I just can't rmember details and also just could not find it in the MySQL-documentation (have to go for a while now!)).

      It would be useful to if you told us if the problem is recent (whether it has worked before or not).

      Is there any chance that you will be able to spot the data/rows that should sync, but don't ?

      ********************************************************************************

      *

      BTW: there is another problem (bug in SQLyog I think!) with your table definition, namely this

      Quote:
      `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

      Sqlyog does not respect the “on update CURRENT_TIMESTAMP” condition (does not write CURRENT_TIMESTAMP, but just keeps the old value. Be aware of that if you use SQLyog to update the table … but that does not relate to the current problem!

    • #18195
      peterlaursen
      Participant

      BTW: I don't think reversing the PK definition would make any difference. It works as well here …

    • #18196
      peterlaursen
      Participant

      I found what I was looking for, it says

      Quote:
      For MyISAM and BDB tables you can specify AUTO_INCREMENT on a secondary column in a multiple-column index. In this case, the generated value for the AUTO_INCREMENT column is calculated as MAX(auto_increment_column)+1 WHERE prefix=given-prefix. This is useful …

      from here: http://dev.mysql.com/doc/mysql/en/example-…-increment.html . But since you are using INNODB, it's not relevant …

    • #18197
      SK Enigma
      Member

      So with a varchar it might not work, but I am using a Bigint

      CREATE TABLE `systemusage` (

      `ID` bigint(25) NOT NULL,

      `UserID` int(10) default NULL,

      `LoginTime` datetime default NULL,

      PRIMARY KEY (`ID`)

      ) ENGINE=InnoDB DEFAULT CHARSET=latin1

      SQLyog Job Agent Version 4.1

      Copyright © Webyog Softworks Pvt. Ltd.. All Rights Reserved.

      Sync started at Thu Nov 17 13:43:13 2005

      Table SrcRows TgtRows Inserted Updated Deleted

      ========================= ======= ======= ======== ======= =======

      `systemusage` 60 51 0 0 0

      Total time taken – 0 sec(s)

      Why Might it sync?

    • #18198
      peterlaursen
      Participant

      @SK Enigma

      this is a very old discussion now! Nobody remembers details.

      You must explain much more in detail. As if it was a new thread.

      for instance:

      Server version?

      SQLyog version?

      Create statment for the table?

      Sample data

      etc …

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