Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7506

Bellow Blackhole engine, update with inner join you'll end up with inconsistent data in your database

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.0.15
    • N/A
    • Replication
    • None

    Description

      Environment:
      master database use MySQL 5.1 ,
      slave level 1 database use Mariadb 10.0.15 ,
      slave level 2 database use MySQL5.1 or MySQL5.6 or Mariadb.

      sample: MySQL 5.1→Mariadb 10.0.15(level 1)→Mariadb 10.0.15(level 2)
      level 1 table use blackhole engine

      1, master database:

      mysql> DROP TABLE IF EXISTS z1,z2;
      Query OK, 0 rows affected (0.21 sec)
       
      mysql> CREATE TABLE z1 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,NAME VARCHAR(100) NOT NULL DEFAULT '');
      Query OK, 0 rows affected (0.00 sec)
       
      mysql> INSERT INTO z1 VALUES(1,'aaa'),(2,'bbb'),(3,'ccc');
      Query OK, 3 rows affected (0.00 sec)
      Records: 3  Duplicates: 0  Warnings: 0
       
      mysql> CREATE TABLE z2 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,NAME VARCHAR(100) NOT NULL DEFAULT '');
      Query OK, 0 rows affected (0.00 sec)
       
      mysql> INSERT INTO z2 VALUES(1,'ddd'),(2,'eee'),(3,'fff');
      Query OK, 3 rows affected (0.00 sec)
      Records: 3  Duplicates: 0  Warnings: 

      2, slave level 1 database:

      mysql> set sql_log_bin=0;                            
      Query OK, 0 rows affected (0.00 sec)
       
      mysql> ALTER TABLE z1 ENGINE=BLACKHOLE;              
      Query OK, 3 rows affected (0.01 sec)
      Records: 3  Duplicates: 0  Warnings: 0
       
      mysql> ALTER TABLE z2 ENGINE=BLACKHOLE;                            
      Query OK, 3 rows affected (0.01 sec)
      Records: 3  Duplicates: 0  Warnings: 0

      3, master database:

      mysql> UPDATE z1,z2 SET z1.NAME='d9' WHERE z1.id=z2.id AND z1.id=3;
      Query OK, 1 row affected (0.01 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
       
      mysql> UPDATE z1,z2 SET z2.NAME='d9' WHERE z1.id=z2.id AND z1.id=3;
      Query OK, 1 row affected (0.00 sec)
      Rows matched: 1  Changed: 1  Warnings: 0

      4, slave level 2 database:

      mysql> select * from z1,z2 where z1.id=z2.id and z1.id=3;
      +----+------+----+------+
      | id | NAME | id | NAME |
      +----+------+----+------+
      |  3 | ccc  |  3 | fff  |
      +----+------+----+------+
      1 row in set (0.00 sec)

      – You can find the data did not update

      5, master database:

      mysql> UPDATE z1,z2 SET z1.NAME='d10',z2.NAME='d10' WHERE z1.id=z2.id AND z1.id=3;   
      Query OK, 2 rows affected (0.00 sec)
      Rows matched: 2  Changed: 2  Warnings: 0

      6, slave level 2 database:

      mysql> select * from z1,z2 where z1.id=z2.id and z1.id=3;
      +----+------+----+------+
      | id | NAME | id | NAME |
      +----+------+----+------+
      |  3 | d10  |  3 | d10  |
      +----+------+----+------+
      1 row in set (0.00 sec)

      Attachments

        Activity

          People

            Unassigned Unassigned
            George Tsao Tsao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.