MDEV-21693 ALGORITHM=INSTANT does not work for partitioned tables

- Flag ALTER_STORED_COLUMN_TYPE set while doing varchar extension
for partition table. Basically all partition supports
can_be_converted_by_engine() then it should be set to
ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE.
parent a17a327f
......@@ -327,3 +327,11 @@ disconnect con3;
disconnect con2;
disconnect con1;
connection default;
CREATE TABLE t1(
f1 INT, f2 VARCHAR(10) CHARSET ascii,
f3 CHAR(150) CHARSET ascii,
f4 TEXT CHARSET ascii)ENGINE=InnoDB
PARTITION BY RANGE(f1) (PARTITION p1 VALUES LESS THAN(10),
PARTITION p2 VALUES LESS THAN (100));
ALTER TABLE t1 convert to charset ascii collate ascii_bin, ALGORITHM=INSTANT;
DROP TABLE t1;
......@@ -205,3 +205,13 @@ DROP TABLE t4;
--disconnect con1
--connection default
# End of Test #3
# MDEV-21693 ALGORITHM=INSTANT does not work for partitioned tables
CREATE TABLE t1(
f1 INT, f2 VARCHAR(10) CHARSET ascii,
f3 CHAR(150) CHARSET ascii,
f4 TEXT CHARSET ascii)ENGINE=InnoDB
PARTITION BY RANGE(f1) (PARTITION p1 VALUES LESS THAN(10),
PARTITION p2 VALUES LESS THAN (100));
ALTER TABLE t1 convert to charset ascii collate ascii_bin, ALGORITHM=INSTANT;
DROP TABLE t1;
/*
Copyright (c) 2005, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB
Copyright (c) 2009, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -11799,6 +11799,40 @@ void ha_partition::clear_top_table_fields()
DBUG_VOID_RETURN;
}
bool
ha_partition::can_convert_string(const Field_string* field,
const Column_definition& new_type) const
{
for (uint index= 0; index < m_tot_parts; index++)
{
if (!m_file[index]->can_convert_string(field, new_type))
return false;
}
return true;
}
bool
ha_partition::can_convert_varstring(const Field_varstring* field,
const Column_definition& new_type) const{
for (uint index= 0; index < m_tot_parts; index++)
{
if (!m_file[index]->can_convert_varstring(field, new_type))
return false;
}
return true;
}
bool
ha_partition::can_convert_blob(const Field_blob* field,
const Column_definition& new_type) const
{
for (uint index= 0; index < m_tot_parts; index++)
{
if (!m_file[index]->can_convert_blob(field, new_type))
return false;
}
return true;
}
struct st_mysql_storage_engine partition_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
......
......@@ -1640,5 +1640,16 @@ class ha_partition :public handler
friend int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2);
friend int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2);
bool can_convert_string(
const Field_string* field,
const Column_definition& new_field) const override;
bool can_convert_varstring(
const Field_varstring* field,
const Column_definition& new_field) const override;
bool can_convert_blob(
const Field_blob* field,
const Column_definition& new_field) const override;
};
#endif /* HA_PARTITION_INCLUDED */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment