Bug #77100 ib_open_table_by_id() gives wrong argument for dict_table_open_on_id()
Submitted: 20 May 2015 4:31 Modified: 25 May 2015 14:27
Reporter: Yasufumi Kinoshita Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.7 OS:Any
Assigned to: CPU Architecture:Any

[20 May 2015 4:31] Yasufumi Kinoshita
Description:
This is InnoDB API bug.

ib_open_table_by_id() always has dict_mutex when calls dict_table_open_on_id().
So, the 2nd argument for dict_table_open_on_id() must be "TRUE".

But the current line is
"table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL);"
and calling ib_open_table_by_id() always causes the self-deadlock about dict_mutex...

How to repeat:
calls ib_open_table_by_id().

Suggested fix:
just change it to TRUE

--- storage/innobase/api/api0api.cc     2015-05-15 01:58:58 +0000
+++ storage/innobase/api/api0api.cc     2015-05-15 02:04:25 +0000
@@ -235,7 +235,7 @@ ib_open_table_by_id(
                dict_mutex_enter_for_mysql();
        }

-       table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL);
+       table = dict_table_open_on_id(table_id, TRUE, DICT_TABLE_OP_NORMAL);

        if (table != NULL && table->ibd_file_missing) {
                table = NULL;
[20 May 2015 13:28] MySQL Verification Team
Bug is verified by inspecting the source code.

And a fix is quite small.
[25 May 2015 14:27] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.6.26, 5.7.8, 5.8.0 releases, and here's the changelog entry:

The "ib_open_table_by_id" function passed an incorrect argument to
"dict_table_open_on_id". 

Thank you for the bug report.