Commit dd439ba6 authored by vasil's avatar vasil

branches/5.1:

Fix Bug#38185 ha_innobase::info can hold locks even when called with HA_STATUS_NO_LOCK

The fix is to call fsp_get_available_space_in_free_extents() from
ha_innobase::info() only if HA_STATUS_NO_LOCK is not present in the flag
*AND*
change get_schema_tables_record() in MySQL's sql/sql_show.cc to call
::info() *without* HA_STATUS_NO_LOCK whenever a user issues SELECT FROM
information_schema.tables;

Without the change to sql/sql_show.cc this patch would lead to Bug#32440
resurfacing. I.e. delete_length would never be updated in ::info() and
will remain 0 forever, resulting in the free space not being shown
anywhere.

This is the change to sql/sql_show.cc for reference, it needs to be
committed to the MySQL repo before or at the same time with this change
to ha_innodb.cc:

 --- patch begins here ---
 --- sql/sql_show.cc.orig	2008-07-23 09:32:14.000000000 +0300
 +++ sql/sql_show.cc	2008-07-23 09:32:19.000000000 +0300
 @@ -3549,8 +3549,7 @@ static int get_schema_tables_record(THD 
  
      if(file)
      {
 -      file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO |
 -                 HA_STATUS_NO_LOCK);
 +      file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO);
        enum row_type row_type = file->get_row_type();
        switch (row_type) {
        case ROW_TYPE_NOT_USED:
 --- patch ends here ---

Approved by:	Heikki
parent 41c1255f
......@@ -5835,9 +5835,21 @@ ha_innobase::info(
stats.index_file_length = ((ulonglong)
ib_table->stat_sum_of_other_index_sizes)
* UNIV_PAGE_SIZE;
stats.delete_length =
fsp_get_available_space_in_free_extents(
ib_table->space) * 1024;
/* Since fsp_get_available_space_in_free_extents() is
acquiring latches inside InnoDB, we do not call it if we
are asked by MySQL to avoid locking. Another reason to
avoid the call is that it uses quite a lot of CPU.
See Bug#38185.
We do not update delete_length if no locking is requested
so the "old" value can remain. delete_length is initialized
to 0 in the ha_statistics' constructor. */
if (!(flag & HA_STATUS_NO_LOCK)) {
stats.delete_length =
fsp_get_available_space_in_free_extents(
ib_table->space) * 1024;
}
stats.check_time = 0;
if (stats.records == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment