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

Master GTT overrides the slave table with the same name

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Not a Bug
    • N/A
    • N/A
    • Replication
    • None
    • Can result in data loss

    Description

      By design we replicate GTT (schema only), this causes the slave table with same name as the master GTT to lose its data and to inherit the master GTT schema.

      MTR test

      -- source include/master-slave.inc
      -- source include/have_binlog_format_statement.inc
       
      connection master;
      connection slave;
       
      --connection slave
      CREATE TABLE mygtt (c CHAR(20));
      INSERT INTO mygtt VALUES ('slave innodb data');
      query_vertical SHOW CREATE TABLE mygtt;
      SELECT * FROM mygtt;
       
      --connection master
      CREATE GLOBAL TEMPORARY TABLE mygtt (i INT, t TEXT);
      INSERT INTO mygtt VALUES (1, 'master mygtt table data');
       
      --connection slave
      SELECT * FROM mygtt;
      SHOW TABLES;
      query_vertical SHOW CREATE TABLE mygtt;
      

      MTR test result

      $ ./mtr --suite=rpl my.test
      Logging: ./mtr  --suite=rpl my.test
      VS config: 
      vardir: /test/MDEV-35915-MD311025-mariadb-12.2.0-linux-x86_64-opt/mariadb-test/var
      Checking leftover processes...
      Removing old var directory...
      Creating var directory '/test/MDEV-35915-MD311025-mariadb-12.2.0-linux-x86_64-opt/mariadb-test/var'...
      Checking supported features...
      MariaDB Version 12.2.0-MariaDB
       - SSL connections supported
      Collecting tests...
      Installing system database...
       
      ==============================================================================
       
      TEST                                      RESULT   TIME (ms) or COMMENT
      --------------------------------------------------------------------------
       
      worker[01] Using MTR_BUILD_THREAD 300, with reserved ports 19000..19029
      include/master-slave.inc
      [connection master]
      connection master;
      connection slave;
      connection slave;
      CREATE TABLE mygtt (c CHAR(20));
      INSERT INTO mygtt VALUES ('slave innodb data');
      SHOW CREATE TABLE mygtt;
      Table	mygtt
      Create Table	CREATE TABLE `mygtt` (
        `c` char(20) DEFAULT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
      SELECT * FROM mygtt;
      c
      slave innodb data
      connection master;
      CREATE GLOBAL TEMPORARY TABLE mygtt (i INT, t TEXT);
      INSERT INTO mygtt VALUES (1, 'master mygtt table data');
      connection slave;
      SELECT * FROM mygtt;
      i	t
      SHOW TABLES;
      Tables_in_test
      mygtt
      SHOW CREATE TABLE mygtt;
      Table	mygtt
      Create Table	CREATE GLOBAL TEMPORARY TABLE `mygtt` (
        `i` int(11) DEFAULT NULL,
        `t` text DEFAULT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ON COMMIT DELETE ROWS
      rpl.my 'stmt'                            [ pass ]    157
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              susil.behera Susil Behera
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.