[Commits] Rev 3360: Made the process of collecting persistent statistics killable. in file:///home/igor/maria/maria-5.5-mwl248/

Igor Babaev igor at askmonty.org
Sat Aug 18 21:49:15 EEST 2012


At file:///home/igor/maria/maria-5.5-mwl248/

------------------------------------------------------------
revno: 3360
revision-id: igor at askmonty.org-20120818184914-ffcz647unaf5octf
parent: igor at askmonty.org-20120817202349-fec5oke7he6c1fxn
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.5-mwl248
timestamp: Sat 2012-08-18 11:49:14 -0700
message:
  Made the process of collecting persistent statistics killable.
-------------- next part --------------
=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc	2012-07-27 00:50:08 +0000
+++ b/sql/sql_admin.cc	2012-08-18 18:49:14 +0000
@@ -716,6 +716,8 @@
           !(compl_result_code=
             collect_statistics_for_table(thd, table->table)))
         compl_result_code= update_statistics_for_table(thd, table->table);
+      if (compl_result_code)
+        result_code= HA_ADMIN_FAILED;
     }
 
     if (result_code == HA_ADMIN_NOT_IMPLEMENTED && need_repair_or_alter)

=== modified file 'sql/sql_statistics.cc'
--- a/sql/sql_statistics.cc	2012-07-30 17:09:58 +0000
+++ b/sql/sql_statistics.cc	2012-08-18 18:49:14 +0000
@@ -1926,7 +1926,7 @@
 */
 
 static
-int collect_statistics_for_index(TABLE *table, uint index)
+int collect_statistics_for_index(THD *thd, TABLE *table, uint index)
 {
   int rc= 0;
   KEY *key_info= &table->key_info[index];
@@ -1944,6 +1944,9 @@
   rc= table->file->ha_index_first(table->record[0]);
   while (rc != HA_ERR_END_OF_FILE)
   {
+    if (thd->killed)
+      break;
+
     if (rc)
       break;
     rows++;
@@ -1953,7 +1956,7 @@
   table->key_read= 0;
   table->file->ha_index_end();
 
-  rc= (rc == HA_ERR_END_OF_FILE) ? 0 : 1;
+  rc= (rc == HA_ERR_END_OF_FILE && !thd->killed) ? 0 : 1;
 
   if (!rc)
     index_prefix_calc.get_avg_frequency();
@@ -2040,6 +2043,9 @@
   {  
     while ((rc= file->ha_rnd_next(table->record[0])) != HA_ERR_END_OF_FILE)
     {
+      if (thd->killed)
+        break;
+
       if (rc)
         break;
 
@@ -2054,7 +2060,7 @@
     }
     file->ha_rnd_end();
   }
-  rc= rc == HA_ERR_END_OF_FILE ? 0 : 1;
+  rc= (rc == HA_ERR_END_OF_FILE && !thd->killed) ? 0 : 1;
 
   /* 
     Calculate values for all statistical characteristics on columns and
@@ -2087,7 +2093,7 @@
     /* Collect statistics for indexes */
     while ((key= it++) != key_map::Iterator::BITMAP_END)
     {
-      if ((rc= collect_statistics_for_index(table, key)))
+      if ((rc= collect_statistics_for_index(thd, table, key)))
         break;
     }
 



More information about the commits mailing list