[Commits] ec4d552: # This is a combination of 2 commits.

OleksandrByelkin sanja at mariadb.com
Fri Dec 18 12:15:25 EET 2015


revision-id: ec4d5525b3d21c9171839b28ea4d7ff42cf87696 (mariadb-10.1.9-20-gec4d552)
parent(s): 953d5680a3c050273a8f29253f7386984679f92b
committer: Oleksandr Byelkin
timestamp: 2015-12-18 11:15:25 +0100
message:

# This is a combination of 2 commits.
# The first commit's message is:

MDEV-9118 ANALYZE TABLE for Engine independent status fetchs blob/text columns without use

Do not include BLOB fields by default.

# The 2nd commit message will be skipped:

#	postreview fixes

---
 mysql-test/r/statistics.result |  2 --
 sql/share/errmsg-utf8.txt      |  3 +++
 sql/sql_admin.cc               | 43 ++++++++++++++++++++++++++++++++++++------
 3 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result
index bd6a084..76c0cf4 100644
--- a/mysql-test/r/statistics.result
+++ b/mysql-test/r/statistics.result
@@ -1225,7 +1225,6 @@ test	t1	c	aaaa	dddddddd	0.1250	6.6571	7.0000	0	NULL	NULL
 test	t1	d	1989-03-12	1999-07-23	0.1500	3.0000	8.5000	0	NULL	NULL
 test	t1	e	0.01	0.112	0.2250	8.0000	6.2000	0	NULL	NULL
 test	t1	f	1	5	0.2000	1.0000	6.4000	0	NULL	NULL
-test	t1	b	NULL	NULL	0.2000	17.1250	NULL	NULL	NULL	NULL
 SELECT * FROM mysql.index_stats;
 db_name	table_name	index_name	prefix_arity	avg_frequency
 test	t1	idx2	1	7.0000
@@ -1276,7 +1275,6 @@ test	t1	c	aaaa	dddddddd	0.1250	6.6571	7.0000	0	NULL	NULL
 test	t1	d	1989-03-12	1999-07-23	0.1500	3.0000	8.5000	0	NULL	NULL
 test	t1	e	0.01	0.112	0.2250	8.0000	6.2000	0	NULL	NULL
 test	t1	f	1	5	0.2000	1.0000	6.4000	0	NULL	NULL
-test	t1	b	NULL	NULL	0.2000	17.1250	NULL	NULL	NULL	NULL
 SELECT * FROM mysql.index_stats;
 db_name	table_name	index_name	prefix_arity	avg_frequency
 test	t1	PRIMARY	1	1.0000
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 59908dc..178d1dd 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7136,3 +7136,6 @@ ER_KILL_QUERY_DENIED_ERROR
         eng "You are not owner of query %lu"
         ger "Sie sind nicht Eigentümer von Abfrage %lu"
         rus "Вы не являетесь владельцем запроса %lu"
+ER_NO_EIS_FOR_FIELD
+        eng "Engine-independent statistics are not collected for column '%s'"
+        ukr "Незалежна від типу таблиці статистика не збирається для стовбця '%s'"
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 0787aa9..27d4530 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -691,11 +691,26 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
         compl_result_code= result_code= HA_ADMIN_INVALID;
       }
 
+      uint columns= 0;
+
       if (!lex->column_list)
-      { 
-        uint fields= 0;
-        for ( ; *field_ptr; field_ptr++, fields++) ;         
-        bitmap_set_prefix(tab->read_set, fields);
+      {
+        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);
+            columns++;
+          }
+          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
       {
@@ -713,8 +728,20 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
             compl_result_code= result_code= HA_ADMIN_INVALID;
             break;
           }
-          bitmap_set_bit(tab->read_set, pos-1);
-        } 
+          pos--;
+          enum enum_field_types type= tab->fields[pos]->type();
+          if (type < MYSQL_TYPE_MEDIUM_BLOB ||
+              type > MYSQL_TYPE_BLOB)
+          {
+            bitmap_set_bit(tab->read_set, pos);
+            columns++;
+          }
+          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);
+        }
         tab->file->column_bitmaps_signal(); 
       }
       
@@ -741,6 +768,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
           tab->keys_in_use_for_query.set_bit(--pos);
         }  
       }
+      if (unlikely(!columns && result_code == HA_ADMIN_OK))
+        goto nothing_to_do;
     }
 
     if (result_code == HA_ADMIN_OK)
@@ -752,6 +781,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
       DBUG_PRINT("admin", ("operator_func returned: %d", result_code));
     }
 
+nothing_to_do:
+
     if (compl_result_code == HA_ADMIN_OK &&
         operator_func == &handler::ha_analyze && 
         table->table->s->table_category == TABLE_CATEGORY_USER &&


More information about the commits mailing list