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

Engine specific create table options are inherited on alter table.

    XMLWordPrintable

Details

    Description

      One test case:

      -- source include/have_innodb.inc
       
      --disable_query_log
      let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
      let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
      let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
      --enable_query_log
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
      # zlib
      set global innodb_compression_algorithm = 1;
       
      create table innodb_1(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
      create table innodb_2(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1;
      create table innodb_3(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
       
      show create table innodb_1;
      show create table innodb_2;
      show create table innodb_3;
       
      --source include/restart_mysqld.inc
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
      # zlib
      set global innodb_compression_algorithm = 1;
       
      alter table innodb_1 engine=innodb;
      alter table innodb_2 engine=innodb;
      alter table innodb_3 engine=innodb;
       
      show create table innodb_1;
      show create table innodb_2;
      show create table innodb_3;
       
      drop table innodb_1;
      drop table innodb_2;
      drop table innodb_3;
       
       
      # reset system
      --disable_query_log
      EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
      EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
      EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
      --enable_query_log

      I would assume if alter table engine=innodb is issued all engine specific options are not inherited. Currently, this is not true:

      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
      set global innodb_compression_algorithm = 1;
      create table innodb_1(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
      create table innodb_2(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1;
      create table innodb_3(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
      show create table innodb_1;
      Table	Create Table
      innodb_1	CREATE TABLE `innodb_1` (
        `c1` bigint(20) NOT NULL,
        `b` char(200) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1
      show create table innodb_2;
      Table	Create Table
      innodb_2	CREATE TABLE `innodb_2` (
        `c1` bigint(20) NOT NULL,
        `b` char(200) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_compressed`=1
      show create table innodb_3;
      Table	Create Table
      innodb_3	CREATE TABLE `innodb_3` (
        `c1` bigint(20) NOT NULL,
        `b` char(200) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `page_compressed`=1
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
      set global innodb_compression_algorithm = 1;
      alter table innodb_1 engine=innodb;
      alter table innodb_2 engine=innodb;
      alter table innodb_3 engine=innodb;
      show create table innodb_1;
      Table	Create Table
      innodb_1	CREATE TABLE `innodb_1` (
        `c1` bigint(20) NOT NULL,
        `b` char(200) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1
      show create table innodb_2;
      Table	Create Table
      innodb_2	CREATE TABLE `innodb_2` (
        `c1` bigint(20) NOT NULL,
        `b` char(200) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_compressed`=1
      show create table innodb_3;
      Table	Create Table
      innodb_3	CREATE TABLE `innodb_3` (
        `c1` bigint(20) NOT NULL,
        `b` char(200) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `page_compressed`=1
      drop table innodb_1;
      drop table innodb_2;
      drop table innodb_3;

      Attachments

        Activity

          People

            serg Sergei Golubchik
            jplindst Jan Lindström (Inactive)
            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.