[Commits] 23d1188: MDEV-10555: Server crashes in mysql_admin_table upon killing ANALYZE

Oleksandr Byelkin sanja at mariadb.com
Wed Mar 8 20:05:45 EET 2017


revision-id: 23d118899fe9fa030e61b6a9ac06df5210d36294 (mariadb-10.2.4-29-g23d1188)
parent(s): 5da6bd7b959af4a9755556afedde8f34d95c679a
committer: Oleksandr Byelkin
timestamp: 2017-03-08 19:05:44 +0100
message:

MDEV-10555: Server crashes in mysql_admin_table upon killing ANALYZE

Take into acount result of open table operation in mysql_admin_table.

---
 sql/sql_admin.cc | 95 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 50 insertions(+), 45 deletions(-)

diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index bc5b9bd..4f87335 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -807,59 +807,64 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
                                       repair_table_use_frm, FALSE);
       thd->open_options&= ~extra_open_options;
 
-      TABLE *tab= table->table;
-      Field **field_ptr= tab->field;
-      if (!lex->column_list)
+      if (!open_error)
       {
-        bitmap_clear_all(tab->read_set);
-        for (uint fields= 0; *field_ptr; field_ptr++, fields++)
+        TABLE *tab= table->table;
+        Field **field_ptr= tab->field;
+        if (!lex->column_list)
         {
-          enum enum_field_types type= (*field_ptr)->type();
-          if (type < MYSQL_TYPE_MEDIUM_BLOB ||
-              type > MYSQL_TYPE_BLOB)
-            bitmap_set_bit(tab->read_set, fields);
-          else
-            push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
-                                ER_NO_EIS_FOR_FIELD,
-                                ER_THD(thd, ER_NO_EIS_FOR_FIELD),
-                                (*field_ptr)->field_name);
+          bitmap_clear_all(tab->read_set);
+          for (uint fields= 0; *field_ptr; field_ptr++, fields++)
+          {
+            enum enum_field_types type= (*field_ptr)->type();
+            if (type < MYSQL_TYPE_MEDIUM_BLOB ||
+                type > MYSQL_TYPE_BLOB)
+              bitmap_set_bit(tab->read_set, fields);
+            else
+              push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+                                  ER_NO_EIS_FOR_FIELD,
+                                  ER_THD(thd, ER_NO_EIS_FOR_FIELD),
+                                  (*field_ptr)->field_name);
+          }
         }
-      }
-      else
-      {
-        int pos;
-        LEX_STRING *column_name;
-        List_iterator_fast<LEX_STRING> it(*lex->column_list);
-
-        bitmap_clear_all(tab->read_set);
-        while ((column_name= it++))
+        else
         {
-          if (tab->s->fieldnames.type_names == 0 ||
-              (pos= find_type(&tab->s->fieldnames, column_name->str,
-                              column_name->length, 1)) <= 0)
+          int pos;
+          LEX_STRING *column_name;
+          List_iterator_fast<LEX_STRING> it(*lex->column_list);
+
+          bitmap_clear_all(tab->read_set);
+          while ((column_name= it++))
           {
-            compl_result_code= result_code= HA_ADMIN_INVALID;
-            break;
+            if (tab->s->fieldnames.type_names == 0 ||
+                (pos= find_type(&tab->s->fieldnames, column_name->str,
+                                column_name->length, 1)) <= 0)
+            {
+              compl_result_code= result_code= HA_ADMIN_INVALID;
+              break;
+            }
+            pos--;
+            enum enum_field_types type= tab->field[pos]->type();
+            if (type < MYSQL_TYPE_MEDIUM_BLOB ||
+                type > MYSQL_TYPE_BLOB)
+              bitmap_set_bit(tab->read_set, pos);
+            else
+              push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+                                  ER_NO_EIS_FOR_FIELD,
+                                  ER_THD(thd, ER_NO_EIS_FOR_FIELD),
+                                  column_name->str);
           }
-          pos--;
-          enum enum_field_types type= tab->field[pos]->type();
-          if (type < MYSQL_TYPE_MEDIUM_BLOB ||
-              type > MYSQL_TYPE_BLOB)
-            bitmap_set_bit(tab->read_set, pos);
-          else
-            push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
-                                ER_NO_EIS_FOR_FIELD,
-                                ER_THD(thd, ER_NO_EIS_FOR_FIELD),
-                                column_name->str);
+          tab->file->column_bitmaps_signal();
         }
-        tab->file->column_bitmaps_signal();
+        if (!(compl_result_code=
+              alloc_statistics_for_table(thd, table->table)) &&
+            !(compl_result_code=
+              collect_statistics_for_table(thd, table->table)))
+          compl_result_code= update_statistics_for_table(thd, table->table);
       }
-      if (!open_error &&
-          !(compl_result_code=
-            alloc_statistics_for_table(thd, table->table)) &&
-          !(compl_result_code=
-            collect_statistics_for_table(thd, table->table)))
-        compl_result_code= update_statistics_for_table(thd, table->table);
+      else
+        compl_result_code= HA_ADMIN_FAILED;
+
       if (compl_result_code)
         result_code= HA_ADMIN_FAILED;
       else


More information about the commits mailing list