summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-04-04 10:13:53 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-04-06 08:56:25 +0300
commit25d69ea0124941cca54dbf0c2ebb2aa20ab2d6a8 (patch)
tree4268c3d90c7121c6fa98d5bd3ab23e726dd7df54 /storage
parent8d4871a95340dc1b9bac67115ddf77f484de41c6 (diff)
downloadmariadb-git-25d69ea0124941cca54dbf0c2ebb2aa20ab2d6a8.tar.gz
MDEV-12198 innodb_defragment=1 crashes server on OPTIMIZE TABLE when FULLTEXT index exists
ha_innobase::defragment_table(): Skip corrupted indexes and FULLTEXT INDEX. In InnoDB, FULLTEXT INDEX is implemented with auxiliary tables. We will not defragment them on OPTIMIZE TABLE.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/ha_innodb.cc11
-rw-r--r--storage/xtradb/handler/ha_innodb.cc11
2 files changed, 22 insertions, 0 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e447af9bdad..f198a18656c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -12599,6 +12599,17 @@ ha_innobase::defragment_table(
for (index = dict_table_get_first_index(table); index;
index = dict_table_get_next_index(index)) {
+ if (dict_index_is_corrupted(index)) {
+ continue;
+ }
+
+ if (index->page == FIL_NULL) {
+ /* Do not defragment auxiliary tables related
+ to FULLTEXT INDEX. */
+ ut_ad(index->type & DICT_FTS);
+ continue;
+ }
+
if (one_index && strcasecmp(index_name, index->name) != 0) {
continue;
}
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 3130dc980d2..d2cd1951bd7 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -13272,6 +13272,17 @@ ha_innobase::defragment_table(
for (index = dict_table_get_first_index(table); index;
index = dict_table_get_next_index(index)) {
+ if (dict_index_is_corrupted(index)) {
+ continue;
+ }
+
+ if (index->page == FIL_NULL) {
+ /* Do not defragment auxiliary tables related
+ to FULLTEXT INDEX. */
+ ut_ad(index->type & DICT_FTS);
+ continue;
+ }
+
if (one_index && strcasecmp(index_name, index->name) != 0) {
continue;
}