From: Annamalai Gurusami Date: December 20 2012 1:59pm Subject: bzr push into mysql-5.5 branch (annamalai.gurusami:4123 to 4124) Bug#13819630 List-Archive: http://lists.mysql.com/commits/145533 X-Bug: 13819630 Message-Id: <20121220135937.2815.30572.4124@rainbow> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4124 Annamalai Gurusami 2012-12-20 Bug #13819630 ARCHIVE TABLE WITH 1000+ PARTITIONS CRASHES SERVER ON "DROP TABLE" In the function ha_archive::write_row(), there is an error code path that exits the function without releasing the mutex that was acquired earlier. rb#1743 approved by ramil. modified: storage/archive/ha_archive.cc 4123 Annamalai Gurusami 2012-12-20 Bug #14556349 RENAME OF COMPRESSED TABLE AND INSERT BUFFER MERGE CAUSE HANG Problem Statement: When the operation RENAME TABLE is about rename the tablespace of the table, it will stop all i/o operations on the tablespace temporarily. For this the fil_space_t::stop_ios member is used. Once the fil_space_t::stop_ios member is set to TRUE in the RENAME TABLE operation, it is expected that no new i/o operation will be done on the tablespace and all pending i/o operation can be completed on the tablespace. If the pending i/o operations initiate any new i/o operations then there will be deadlock. The RENAME TABLE operation will be waiting for pending i/o on the tablespace to be completed, and the pending i/o operations will be waiting on the RENAME TABLE operation to set the file_space_t::stop_ios flag to be set to FALSE. But in the given scenario the pending i/o operations did not initiate new i/o. But they where still unnecessarily checking the fil_space_t::stop_ios flag. This resulted in deadlock. Solution: I noticed that this deadlock happens in fil_space_get_size() and fil_space_get_zip_size() in the i/o threads. These functions check the stop_ios flag even when no i/o will be initiated. I modified these functions to ensure that they check the stop_ios flag only when they will be initiating an i/o operation. This solves the problem. rb://1635 (mysql-5.5) rb://1660 (mysql-trunk) approved by Inaam, Jimmy, and ima. modified: storage/innobase/fil/fil0fil.c === modified file 'storage/archive/ha_archive.cc' --- a/storage/archive/ha_archive.cc revid:annamalai.gurusami@stripped +++ b/storage/archive/ha_archive.cc revid:annamalai.gurusami@stripped @@ -898,10 +898,11 @@ int ha_archive::write_row(uchar *buf) table->timestamp_field->set_time(); mysql_mutex_lock(&share->mutex); - if (!share->archive_write_open) - if (init_archive_writer()) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - + if (!share->archive_write_open && init_archive_writer()) + { + rc= HA_ERR_CRASHED_ON_USAGE; + goto error; + } if (table->next_number_field && record == table->record[0]) { @@ -980,8 +981,8 @@ int ha_archive::write_row(uchar *buf) rc= real_write_row(buf, &(share->archive_write)); error: mysql_mutex_unlock(&share->mutex); - my_free(read_buf); - + if (read_buf) + my_free(read_buf); DBUG_RETURN(rc); } No bundle (reason: useless for push emails).