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

ADD CHECK leaves an orphaned .par file

Details

    Description

      Executing ALTER TABLE ADD CHECK on a partitioned InnoDB table leaves an orphaned .par file behind. To reproduce, execute the following:

      drop database if exists orphan_par_test;
      create database orphan_par_test;
      use orphan_par_test;
      drop table if exists t;
      create table t(id int, d DATE NOT NULL, manual_override BOOL NOT NULL DEFAULT 0, primary key(id,d))
      PARTITION BY RANGE COLUMNS (d) ( 
      PARTITION p20161017 VALUES LESS THAN ('2016-10-18'),
      PARTITION p20161018 VALUES LESS THAN ('2016-10-19'));
      ALTER TABLE t ADD CHECK (b IN (0, 1));
      

      And then execute the following:

      drop database orphan_par_test;
      

      The statement will fail with the following error:

      MariaDB [orphan_par_test]> drop database orphan_par_test;
      ERROR 1010 (HY000): Error dropping database (can't rmdir './orphan_par_test', errno: 39 "Directory not empty")
      

      And we can see that the directory is non-empty because of the orphaned .par file:

      [ec2-user@ip-172-30-0-32 ~]$ sudo ls -l /var/lib/mysql/orphan_par_test/
      total 4
      -rw-rw---- 1 mysql mysql 48 Mar 28 19:01 #sql-32a_6.par
      

      Attachments

        Issue Links

          Activity

            --source include/have_innodb.inc
            --source include/have_partition.inc
             
            --let $datadir=`SELECT @@datadir`
             
            drop database if exists orphan_par_test;
            create database orphan_par_test;
            use orphan_par_test;
            drop table if exists t;
            create table t(id int, d DATE NOT NULL, b BOOL NOT NULL DEFAULT 0, primary key(id,d))
            ENGINE=InnoDB
            PARTITION BY RANGE COLUMNS (d) ( 
            PARTITION p20161017 VALUES LESS THAN ('2016-10-18'),
            PARTITION p20161018 VALUES LESS THAN ('2016-10-19'));
            ALTER TABLE t ADD CHECK (b IN (0, 1));
            --list_files $datadir/orphan_par_test 
            drop database orphan_par_test;
            

            10.0, 10.1 are affected, 10.2 is not.
            GeoffMontee, do you need a fix for this in 10.1?

            elenst Elena Stepanova added a comment - --source include/have_innodb.inc --source include/have_partition.inc   --let $datadir=`SELECT @@datadir`   drop database if exists orphan_par_test; create database orphan_par_test; use orphan_par_test; drop table if exists t; create table t(id int , d DATE NOT NULL , b BOOL NOT NULL DEFAULT 0, primary key (id,d)) ENGINE=InnoDB PARTITION BY RANGE COLUMNS (d) ( PARTITION p20161017 VALUES LESS THAN ( '2016-10-18' ), PARTITION p20161018 VALUES LESS THAN ( '2016-10-19' )); ALTER TABLE t ADD CHECK (b IN (0, 1)); --list_files $datadir/orphan_par_test drop database orphan_par_test; 10.0, 10.1 are affected, 10.2 is not. GeoffMontee , do you need a fix for this in 10.1?

            People

              serg Sergei Golubchik
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              1 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.