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

Failed partitioned CREATE TABLE adds a misleading .par file deletion error

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.11, 11.4, 11.8, 12.3, 13.1, 12.3.3
    • 10.11, 11.4, 11.8, 12.3, 13.1
    • Partitioning
    • None
    • Linux x86_64, MariaDB 12.3.3-MariaDB-ubu2404 binary distribution

    Description

      A partitioned InnoDB CREATE TABLE that is rejected because of ROW_FORMAT=FIXED additionally reports Error 6 for deletion of a nonexistent .par file. The equivalent non-partitioned failure reports only the expected invalid-row-format diagnostics.

      The database must not already exist. Run this script in one MariaDB client session:

      CREATE DATABASE create_test;
      USE create_test;
      SET SESSION innodb_strict_mode=ON;
       
      DELIMITER //
      CREATE PROCEDURE check_create(IN partitioned_case BOOLEAN)
      BEGIN
        DECLARE EXIT HANDLER FOR SQLEXCEPTION
        BEGIN
          SHOW WARNINGS;
        END;
       
        IF partitioned_case THEN
          CREATE TABLE part_t (i INT)
            ENGINE=InnoDB ROW_FORMAT=FIXED
            PARTITION BY HASH(i)
            (PARTITION p0,
             PARTITION p1);
        ELSE
          CREATE TABLE plain_t (i INT)
            ENGINE=InnoDB ROW_FORMAT=FIXED;
        END IF;
      END//
      DELIMITER ;
       
      SELECT 'plain' AS case_name;
      CALL check_create(FALSE);
      SELECT 'partitioned' AS case_name;
      CALL check_create(TRUE);
       
      SELECT COUNT(*) AS rejected_tables_remaining
        FROM information_schema.tables
        WHERE table_schema='create_test';
       
      CREATE TABLE plain_t (i INT) ENGINE=InnoDB;
      CREATE TABLE part_t (i INT) ENGINE=InnoDB
        PARTITION BY HASH(i)
        (PARTITION p0,
         PARTITION p1);
       
      INSERT INTO plain_t VALUES (1),(2);
      INSERT INTO part_t VALUES (1),(2);
       
      SELECT (SELECT SUM(i) FROM plain_t)=3
         AND (SELECT SUM(i) FROM part_t)=3 AS retry_ok;

      The relevant output is:

      case_name
      plain
      Level   Code  Message
      Warning 1478  InnoDB: invalid ROW_FORMAT specifier.
      Error   1005  Can't create table `create_test`.`plain_t` (errno: 140 "Wrong create options")
      Warning 1030  Got error 140 "Wrong create options" from storage engine InnoDB
      case_name
      partitioned
      Level   Code  Message
      Warning 1478  InnoDB: invalid ROW_FORMAT specifier.
      Error   1005  Can't create table `create_test`.`part_t` (errno: 140 "Wrong create options")
      Warning 1030  Got error 140 "Wrong create options" from storage engine InnoDB
      Error   6     Error on delete of './create_test/part_t.par' (Errcode: 2 "No such file or directory")
      rejected_tables_remaining
      0
      retry_ok
      1

      Both invalid CREATE TABLE statements should fail with the InnoDB wrong-create-options diagnostics, and neither rejected table should remain. The partitioned case should not add Error 6 for a .par file that has already been removed. The zero-table result and successful recreation show that the failure cleanup otherwise completed and that both names remained reusable.

      This occurs when a partitioned InnoDB CREATE TABLE uses the invalid ROW_FORMAT=FIXED option while innodb_strict_mode is enabled.

      Optional cleanup after reproducing:

      DROP DATABASE IF EXISTS create_test;

      Attachments

        Activity

          People

            ycp Yuchen Pei
            Wren Qin
            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.