MDEV-35562 Do not emit warning when deleting .par file in quick_rm_table

...just like the when deleting the .frm file in the same function.
This improves consistency: internal duplicate deletion of .par file
and .frm file both fail silently.
This commit is contained in:
Yuchen Pei 2025-12-15 17:09:21 +11:00
commit db26f446fd
No known key found for this signature in database
GPG key ID: 3DD1B35105743563
7 changed files with 71 additions and 10 deletions

View file

@ -391,3 +391,28 @@ partitio values in (2, 3, 4),
pn values in (52, 53, 54));
drop table t1;
# End of 10.7 tests
#
# MDEV-35562 On partitionen tables algorithm is not supported
# throw "no such file or directory" error
#
set @old_alter_algorithm=@@alter_algorithm;
set alter_algorithm='NOCOPY';
CREATE TABLE t1par (
f1 datetime ,
f2 VARCHAR(2) ,
f3 VARCHAR(200) NOT NULL ,
f4 VARCHAR(100) charset utf8
)
PARTITION BY RANGE COLUMNS(f2)
(
PARTITION p_01 VALUES LESS THAN ('02') ENGINE = InnoDB,
PARTITION p_31 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB
);
ALTER online TABLE t1par MODIFY COLUMN f3 VARCHAR(201) NULL , LOCK=NONE;
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
show warnings;
Level Code Message
Error 1845 ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
drop table t1par;
set alter_algorithm=@old_alter_algorithm;
# End of 10.11 tests

View file

@ -323,3 +323,29 @@ partition by list(x) (
drop table t1;
--echo # End of 10.7 tests
--echo #
--echo # MDEV-35562 On partitionen tables algorithm is not supported
--echo # throw "no such file or directory" error
--echo #
set @old_alter_algorithm=@@alter_algorithm;
set alter_algorithm='NOCOPY';
CREATE TABLE t1par (
f1 datetime ,
f2 VARCHAR(2) ,
f3 VARCHAR(200) NOT NULL ,
f4 VARCHAR(100) charset utf8
)
PARTITION BY RANGE COLUMNS(f2)
(
PARTITION p_01 VALUES LESS THAN ('02') ENGINE = InnoDB,
PARTITION p_31 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB
);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER online TABLE t1par MODIFY COLUMN f3 VARCHAR(201) NULL , LOCK=NONE;
show warnings;
drop table t1par;
set alter_algorithm=@old_alter_algorithm;
--echo # End of 10.11 tests

View file

@ -670,8 +670,10 @@ int ha_partition::rename_table(const char *from, const char *to)
SYNOPSIS
create_partitioning_metadata()
path Path to the new frm file (without ext)
old_p Path to the old frm file (without ext)
create_info Create info generated for CREATE TABLE
old_path Path to the old frm file (without ext)
action_flag Action to take
ignore_delete_error Whether to ignore error in call to
mysql_file_delete
RETURN VALUE
>0 Error
@ -687,7 +689,8 @@ int ha_partition::rename_table(const char *from, const char *to)
int ha_partition::create_partitioning_metadata(const char *path,
const char *old_path,
chf_create_flags action_flag)
chf_create_flags action_flag,
bool ignore_delete_error)
{
partition_element *part;
DBUG_ENTER("ha_partition::create_partitioning_metadata");
@ -706,7 +709,8 @@ int ha_partition::create_partitioning_metadata(const char *path,
strxmov(name, path, ha_par_ext, NullS);
strxmov(old_name, old_path, ha_par_ext, NullS);
if ((action_flag == CHF_DELETE_FLAG &&
mysql_file_delete(key_file_ha_partition_par, name, MYF(MY_WME))) ||
mysql_file_delete(key_file_ha_partition_par, name,
ignore_delete_error ? MYF(0) : MYF(MY_WME))) ||
(action_flag == CHF_RENAME_FLAG &&
mysql_file_rename(key_file_ha_partition_par, old_name, name,
MYF(MY_WME))))

View file

@ -552,7 +552,8 @@ public:
HA_CREATE_INFO *create_info) override;
int create_partitioning_metadata(const char *name,
const char *old_name,
chf_create_flags action_flag)
chf_create_flags action_flag,
bool ignore_delete_error)
override;
bool check_if_updates_are_ignored(const char *op) const override;
void update_create_info(HA_CREATE_INFO *create_info) override;

View file

@ -5696,7 +5696,8 @@ handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info_arg)
int
handler::ha_create_partitioning_metadata(const char *name,
const char *old_name,
chf_create_flags action_flag)
chf_create_flags action_flag,
bool ignore_delete_error)
{
/*
Normally this is done when unlocked, but in fast_alter_partition_table,
@ -5706,7 +5707,8 @@ handler::ha_create_partitioning_metadata(const char *name,
DBUG_ASSERT(m_lock_type == F_UNLCK ||
(!old_name && strcmp(name, table_share->path.str)));
return create_partitioning_metadata(name, old_name, action_flag);
return create_partitioning_metadata(name, old_name, action_flag,
ignore_delete_error);
}

View file

@ -3529,7 +3529,8 @@ public:
int ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info);
int ha_create_partitioning_metadata(const char *name, const char *old_name,
chf_create_flags action_flag);
chf_create_flags action_flag,
bool ignore_delete_error= false);
int ha_change_partitions(HA_CREATE_INFO *create_info,
const char *path,
@ -5071,7 +5072,8 @@ public:
virtual int create_partitioning_metadata(const char *name,
const char *old_name,
chf_create_flags action_flag)
chf_create_flags action_flag,
bool ignore_delete_error)
{ return FALSE; }
virtual int change_partitions(HA_CREATE_INFO *create_info,

View file

@ -2102,7 +2102,8 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
handler *file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
if (!file)
DBUG_RETURN(true);
(void) file->ha_create_partitioning_metadata(path, NULL, CHF_DELETE_FLAG);
(void) file->ha_create_partitioning_metadata(path, NULL, CHF_DELETE_FLAG,
true);
delete file;
}
if (!(flags & (FRM_ONLY|NO_HA_TABLE)))