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

Engine specific create table options are inherited on alter table.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Bug
    • Affects Version/s: 10.1.1
    • Fix Version/s: N/A
    • Labels:
      None

      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;
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            jplindst Jan Lindström added a comment -

            Also 5.5/10.0 may be affected (but not above example).

            Show
            jplindst Jan Lindström added a comment - Also 5.5/10.0 may be affected (but not above example).
            Hide
            serg Sergei Golubchik added a comment -

            They are intentionally inherited, even if you alter to a different storage engine.
            ALTER TABLE changes only what you specified explicitly in the ALTER TABLE statement. If you do

            ALTER TABLE t1 ENGINE=innodb
            

            it should only change the storage engine to innodb, and not modify any columns, indexes, table comment, table character set, or any other attributes.

            Show
            serg Sergei Golubchik added a comment - They are intentionally inherited, even if you alter to a different storage engine. ALTER TABLE changes only what you specified explicitly in the ALTER TABLE statement. If you do ALTER TABLE t1 ENGINE=innodb it should only change the storage engine to innodb, and not modify any columns, indexes, table comment, table character set, or any other attributes.

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                jplindst Jan Lindström
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: