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

On partitionen tables algorithm is not supported throw "no such file or directory" error

Details

    Description

      To reproduce:

      docker run -d -P  --name par1 --env MARIADB_ROOT_PASSWORD=Password123!  mariadb:latest
       
      mysql -h127.0.0.1 -uroot -pPassword123! -P32768
      

      create database if not exists d1 ;
       
      use d1;
      drop table if exists t1;
       
      CREATE TABLE t1par (
      f1 datetime ,
      f2 VARCHAR(2) ,
      f3 VARCHAR(200) NOT NULL ,
      f4 VARCHAR(100) charset utf8
      )
      /*!50100 PARTITION BY RANGE COLUMNS(f2) (PARTITION p_01 VALUES LESS THAN ('02') ENGINE = InnoDB, PARTITION p_31 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB ) */;
       
      CREATE TABLE t1nopar (
      f1 datetime ,
      f2 VARCHAR(2) ,
      f3 VARCHAR(200) NOT NULL ,
      f4 VARCHAR(100) charset utf8
      );
      

      So we have the same table as partitoned and non partitioned table.

      We want to alter column f3(200) from not NULL to NULL,
      which is not allowed for algorithm "NOCOPY".

      https://mariadb.com/kb/en/innodb-online-ddl-operations-with-the-nocopy-alter-algorithm/#changing-a-column-to-null

      So we get , as expected , an error message.

      Non-paritioned table:

      MariaDB [d1]> SET SESSION alter_algorithm = 'NOCOPY' ;
      Query OK, 0 rows affected (0,000 sec)
       
      MariaDB [d1]> ALTER online TABLE t1nopar   MODIFY COLUMN f3 VARCHAR(201) NULL , LOCK=NONE;
      ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
      MariaDB [d1]> 
      MariaDB [d1]> show warnings;
      +-------+------+-----------------------------------------------------------------------------+
      | Level | Code | Message                                                                     |
      +-------+------+-----------------------------------------------------------------------------+
      | Error | 1845 | ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE |
      +-------+------+-----------------------------------------------------------------------------+
      1 row in set (0,000 sec)
      
      

      For partitioned table the output of "show warnings" looks different:

      MariaDB [d1]> SET SESSION alter_algorithm = 'NOCOPY' ;
      Query OK, 0 rows affected (0,000 sec)
       
       
      MariaDB [d1]> ALTER online TABLE t1par   MODIFY COLUMN f3 VARCHAR(201) NULL , LOCK=NONE;
      ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
      MariaDB [d1]> show warnings;
      +-------+------+---------------------------------------------------------------------------------------+
      | Level | Code | Message                                                                               |
      +-------+------+---------------------------------------------------------------------------------------+
      | Error | 1845 | ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE           |
      | Error |    6 | Error on delete of './d1/#sql-alter-1-3.par' (Errcode: 2 "No such file or directory") |
      +-------+------+---------------------------------------------------------------------------------------+
      2 rows in set (0,000 sec)
      
      

      The message

      Error on delete of './d1/#sql-alter-1-3.par' (Errcode: 2 "No such file or directory")

      indicates of an issue regarding permissions or path. which is not the case,
      so it is misleading and should be changed to a more clear verbose one.

      Attachments

        Activity

          ycp Yuchen Pei added a comment -

          It's a bit strange. The failure happens in the misleadingly named ha_partition::create_partitioning_metadata(), when it tries to delete a partition.

          int ha_partition::create_partitioning_metadata(const char *path,
                                                         const char *old_path,
                                                         chf_create_flags action_flag)
          {
          #  [... 16 lines elided]
              if ((action_flag == CHF_DELETE_FLAG &&
                   mysql_file_delete(key_file_ha_partition_par, name, MYF(MY_WME))) ||

          However, previously the same function was called with the create flag, to create a partition with the same name successfully. So the question is why does the delete fail? To be continued.

          ycp Yuchen Pei added a comment - It's a bit strange. The failure happens in the misleadingly named ha_partition::create_partitioning_metadata() , when it tries to delete a partition. int ha_partition::create_partitioning_metadata( const char *path, const char *old_path, chf_create_flags action_flag) { # [... 16 lines elided] if ((action_flag == CHF_DELETE_FLAG && mysql_file_delete(key_file_ha_partition_par, name, MYF(MY_WME))) || However, previously the same function was called with the create flag, to create a partition with the same name successfully. So the question is why does the delete fail? To be continued.

          People

            holyfoot Alexey Botchkov
            Richard Richard Stracke
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.