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

Unknown engine-defined option on a partition is silently discarded instead of failing with ER_UNKNOWN_OPTION

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 13.0
    • 12.3
    • Partitioning
    • None

    Description

      An engine-defined table option that the storage engine doesn't know fails with error 1911 when it is set for the whole table. The same option set for a single partition is silently discarded: no error, no warning (not even in strict mode), and it isn't in SHOW CREATE TABLE. A typo in a per-partition option, such as PAGE_COMPRESED, therefore goes unnoticed, and the partition is created without the intended setting.

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      # Table level: error, as expected
      --error ER_UNKNOWN_OPTION
      CREATE TABLE t1 (a INT) ENGINE=InnoDB PAGE_COMPRESED=1;
       
      # Partition level: accepted, no warning, option gone
      CREATE TABLE t (a INT) ENGINE=InnoDB
      PARTITION BY HASH (a) (PARTITION p0 PAGE_COMPRESED=1, PARTITION p1);
      SHOW WARNINGS;
      SHOW CREATE TABLE t;
      DROP TABLE t;

      Result on 13.0.2 with the default sql_mode (STRICT_TRANS_TABLES,...):

      CREATE TABLE t1 (a INT) ENGINE=InnoDB PAGE_COMPRESED=1;
      ERROR 1911 (HY000): Unknown option 'PAGE_COMPRESED'
       
      CREATE TABLE t (...) PARTITION BY HASH (a) (PARTITION p0 PAGE_COMPRESED=1, PARTITION p1);
      -- succeeds, SHOW WARNINGS is empty
      SHOW CREATE TABLE t:
       PARTITION BY HASH (`a`)
      (PARTITION `p0` ENGINE = InnoDB,
       PARTITION `p1` ENGINE = InnoDB)

      With IGNORE_BAD_TABLE_OPTIONS added to sql_mode, the option is kept (PARTITION p0 ENGINE = InnoDB `PAGE_COMPRESED`='1'), so only the default (error) path is affected.

      Expected: the same as at table level: ER_UNKNOWN_OPTION unless IGNORE_BAD_TABLE_OPTIONS is set.

      Possibly relevant: for the whole table, mysql_prepare_create_table() in sql/sql_table.cc calls parse_option_list(..., suppress_warning=FALSE, ...). For partitions, parse_engine_part_options() in sql/create_options.cc calls parse_option_list(..., TRUE, ...). Whether that explains the drop from the .frm too, I haven't confirmed.

      Reproduced on 13.0.2; likely affects every version since 10.8.1 (per-partition engine options, MDEV-5271), but only 13.0 was tested.

      Found while documenting per-partition options (MDEV-27564). The docs describe this behavior as is ("ignored without an error or warning") and will be updated when this is fixed.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              stefan.hinz Stefan Hinz
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.