Commit b3d77069 authored by Timothy Smith's avatar Timothy Smith

Apply InnoDB snapshot innodb-5.1-ss2858, part 4. Fixes

Bug #39438: Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch


Detailed revision comments:

r2719 | vasil | 2008-10-03 18:17:28 +0300 (Fri, 03 Oct 2008) | 49 lines
branches/5.1:

Fix Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch

In ha_innobase::info() - do not try to get the free space for a tablespace
which has been discarded with ALTER TABLE ... DISCARD TABLESPACE or if the
.ibd file is missing for some other reason.

ibd_file_missing and tablespace_discarded are manipulated only in
row_discard_tablespace_for_mysql() and in row_import_tablespace_for_mysql()
and the manipulation is protected/surrounded by
row_mysql_lock_data_dictionary()/row_mysql_unlock_data_dictionary() thus we
do the same in ha_innobase::info() when checking the values of those members
to avoid race conditions. I have tested the code-path with UNIV_DEBUG and
UNIV_SYNC_DEBUG.

rb://20

Reviewed by:	Inaam, Calvin
Approved by:	Heikki
parent cfd1095c
......@@ -412,7 +412,10 @@ sub mtr_report_stats ($) {
# When trying to set lower_case_table_names = 2
# on a case sensitive file system. Bug#37402.
/lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
/lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
# this test is expected to print warnings
($testname eq 'main.innodb_bug39438')
)
{
next; # Skip these lines
......
SET storage_engine=InnoDB;
#
# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
# http://bugs.mysql.com/39438
#
# This test must be run with innodb_file_per_table=1 because the crash
# only occurs if that option is turned on and DISCARD TABLESPACE only
# works with innodb_file_per_table.
#
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server
-- disable_query_log
-- disable_result_log
DROP TABLE IF EXISTS bug39438;
CREATE TABLE bug39438 (id INT) ENGINE=INNODB;
ALTER TABLE bug39438 DISCARD TABLESPACE;
# this crashes the server if the bug is present
SHOW TABLE STATUS;
DROP TABLE bug39438;
......@@ -5865,9 +5865,24 @@ ha_innobase::info(
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;
/* lock the data dictionary to avoid races with
ibd_file_missing and tablespace_discarded */
row_mysql_lock_data_dictionary(prebuilt->trx);
/* ib_table->space must be an existent tablespace */
if (!ib_table->ibd_file_missing
&& !ib_table->tablespace_discarded) {
stats.delete_length =
fsp_get_available_space_in_free_extents(
ib_table->space) * 1024;
} else {
stats.delete_length = 0;
}
row_mysql_unlock_data_dictionary(prebuilt->trx);
}
stats.check_time = 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