Bug #66718 | Assert from DROP TABLE concurrent with ibuf merges | ||
---|---|---|---|
Submitted: | 6 Sep 2012 4:23 | Modified: | 18 Oct 2012 19:21 |
Reporter: | Mark Callaghan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB Plugin storage engine | Severity: | S3 (Non-critical) |
Version: | 5.1, 5.5 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[6 Sep 2012 4:23]
Mark Callaghan
[6 Sep 2012 17:38]
Mark Callaghan
My summary of the race. reader thread: calls fil_tablespace_deleted_or_being_deleted_in_mem in buf_page_init_for_read dropper thread: sets is_being_deleted and waits for n_pending==0 in fil_delete_tablespace reader thread: increments n_pending in fil_io The work described above by the reader thread needs to be atomic. It isn't today.
[6 Sep 2012 17:43]
Mark Callaghan
Is this fixed by adding a check for "space->is_being_deleted" to fil_io before the call to fil_node_prepare_for_io?
[6 Sep 2012 19:25]
Mark Callaghan
It is safe to do that check and return DB_TABLESPACE_DELETED for async reads. It is not OK to do that for writes as many fil_io callers don't check return results and don't expect a failure, including buf_flush_buffered_writes
[12 Sep 2012 4:01]
Inaam Rana
Mark, I am in process of writing a patch for this. Do you have a test case to reproduce this on 5.5? You mentioned that your 'patch' to easily reproduce it messy but there doesn't seem to be an easy way to reproduce this. When you saw the actual crash the reader thread was doing read io for what operation? It can't be a query thread because query threads should wait on MDL. I'd think it was a read request triggered by ibuf merge from master thread.
[12 Sep 2012 23:46]
Mark Callaghan
I found it via the same testcase I provided for the SR associated with bugs.mysql.com/64284. I will attach what I think is the diff between 5.5 latest in trunk and my hacked version to make repro more likely.
[12 Sep 2012 23:46]
Mark Callaghan
Diff for Mysql 5.5 latest from trunk to make repro more likely
Attachment: repro.66718 (application/octet-stream, text), 7.41 KiB.
[12 Sep 2012 23:47]
Mark Callaghan
repro test
Attachment: innodb_drop_table_ibuf-master.opt (application/octet-stream, text), 150 bytes.
[12 Sep 2012 23:47]
Mark Callaghan
repro test
Attachment: innodb_drop_table_ibuf.test (application/octet-stream, text), 2.45 KiB.
[12 Sep 2012 23:47]
Mark Callaghan
repro test
Attachment: innodb_drop_table_ibuf.test (application/octet-stream, text), 2.45 KiB.
[18 Oct 2012 19:21]
John Russell
Added to changelog for 5.5.29, 5.6.8, 5.7.0: With the innodb_file_per_table setting enabled, a DROP TABLE operation could cause a crash, due to a race condition that depended on the timing of pending I/O requests.