summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-05-28 20:54:38 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-05-28 20:55:59 +0300
commitdac1280a65a97ac49c588d344a33fd7bb49c6737 (patch)
tree6d02f74599794e08495220c34e0e40658e9ab240 /sql/sql_partition.cc
parentdad7a8ee7dab99c0ba3d98ac12d0235462f3029e (diff)
downloadmariadb-git-dac1280a65a97ac49c588d344a33fd7bb49c6737.tar.gz
MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
System versioning assertion fix. Since DROP SYSTEM VERSIONING does not change list of dropped keys we should handle a special case. Caused by MDEV-19751. This fix deprecates MDEV-17091.
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc50
1 files changed, 21 insertions, 29 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index b7b400f490a..f7158a2b1ee 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -5986,26 +5986,35 @@ the generated partition syntax in a correct manner.
}
}
/*
- Prohibit inplace when partitioned by primary key and the primary key is dropped.
+ Prohibit inplace when partitioned by primary key and the primary key is changed.
*/
if (!*partition_changed &&
tab_part_info->part_field_array &&
!tab_part_info->part_field_list.elements &&
table->s->primary_key != MAX_KEY)
{
- KEY *primary_key= table->key_info + table->s->primary_key;
- List_iterator_fast<Alter_drop> drop_it(alter_info->drop_list);
- const char *primary_name= primary_key->name.str;
- const Alter_drop *drop;
- drop_it.rewind();
- while ((drop= drop_it++))
+
+ if (alter_info->flags & (ALTER_DROP_SYSTEM_VERSIONING |
+ ALTER_ADD_SYSTEM_VERSIONING))
{
- if (drop->type == Alter_drop::KEY &&
- 0 == my_strcasecmp(system_charset_info, primary_name, drop->name))
- break;
+ *partition_changed= true;
+ }
+ else
+ {
+ KEY *primary_key= table->key_info + table->s->primary_key;
+ List_iterator_fast<Alter_drop> drop_it(alter_info->drop_list);
+ const char *primary_name= primary_key->name.str;
+ const Alter_drop *drop;
+ drop_it.rewind();
+ while ((drop= drop_it++))
+ {
+ if (drop->type == Alter_drop::KEY &&
+ 0 == my_strcasecmp(system_charset_info, primary_name, drop->name))
+ break;
+ }
+ if (drop)
+ *partition_changed= TRUE;
}
- if (drop)
- *partition_changed= TRUE;
}
}
if (thd->work_part_info)
@@ -6039,23 +6048,6 @@ the generated partition syntax in a correct manner.
}
}
- // In case of PARTITION BY KEY(), check if primary key has changed
- // System versioning also implicitly adds/removes primary key parts
- if (alter_info->partition_flags == 0 && part_info->list_of_part_fields
- && part_info->part_field_list.elements == 0)
- {
- if (alter_info->flags & (ALTER_DROP_SYSTEM_VERSIONING |
- ALTER_ADD_SYSTEM_VERSIONING))
- *partition_changed= true;
-
- List_iterator<Key> it(alter_info->key_list);
- Key *key;
- while((key= it++) && !*partition_changed)
- {
- if (key->type == Key::PRIMARY)
- *partition_changed= true;
- }
- }
/*
Set up partition default_engine_type either from the create_info
or from the previus table