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

slave_type_conversions does not check for NOT NULL or DEFAULT differences

    XMLWordPrintable

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.6.8
    • 10.6
    • Replication
    • None
    • Only tested on 10.6.8 so far, but it's probably on all versions

    Description

      Consider the following replication situation:

      • binlog_format=ROW
      • slave_type_conversions is empty, so tables should be defined the same on master and slave for replication to work
      • a column on the master is created with "NULL", but on the slave it has same type and size, but "NOT NULL DEFAULT ..." instead

      E.g.:

      • on master: CREATE TABLE t1(id int not null primary key, msg varchar(100) NULL);
      • on slave: ALTER TABLE t1 MODIFY COLUMN msg varchar(100) NOT NULL DEFAULT 'abc';
      • on master: INSERT INTO TABLE t1 VALUES(1, NULL); SELECT * FROM t1;
      • -> result id:1; msg: NULL
      • on slave: SELECT * FROM t1;
      • -> result id: 1; msg: 'abc'

      So now we have a data inconsistency between master and slave even though slave_type_conversions='' should have prevented this.

      Double check to see that slave type conversion checks are indeed in effect:

      • on master CREATE TABLE t2(id int not null primary key, msg varchar(100));
      • on slave ALTER TABLE t2 MODIFY COLUMN msg varchar(200);
      • on master: INSERT INTO t2 VALUES(1, NULL);
      • on slave -> Last_SQL_Error: Column 1 of table 'test.t2' cannot be converted from type 'varchar(400 octets)' to type 'varchar(800 octets) character set utf8mb4'

      Attachments

        Activity

          People

            Elkin Andrei Elkin
            hholzgra Hartmut Holzgraefe
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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