Skip to content

Commit 00e9ed1

Browse files
author
Nisha Gopalakrishnan
committed
BUG#32288105: MYSQL CRASHES IMMEDIATELY AFTER SELECTING FROM
INFORMATION_SCHEMA ISSUE Queries on tables executed after querying the INFORMATION_SCHEMA tables INNODB_TABLES, INNODB_COLUMNS, INNODB_INDEXES, INNODB_TABLESTATS and INNODB_VIRTUAL can trigger an assert on case insensitive file system where the lower-case-table-names is set to 2. ROOT CAUSE When querying the I_S tables, the function dd_table_open_on_dd_obj() is called to load the table definition from the DD object. However, if the table was created with a mixed-case schema or table name, dd_table_open_on_dd_obj() does not convert the name to lowercase before adding it to dictionary cache. Subsequent queries look up the cache using the lowercase name, but since the entry was stored with mixed casing, it is not found. Hence it tries to add to cache using dict_table_add_to_cache(). During error checks before adding an entry, the cache is searched using the table id and finds an entry in the cache triggering an assert. FIX The function dd_table_open_on_dd_obj() is modified to convert the name to lower case before loading the table definition and adding to the dictionary cache on case insensitive file sytem. Change-Id: Id902acfc3622b6af869f5b9dc830d0be58cc09c8
1 parent e319d3a commit 00e9ed1

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

mysql-test/suite/innodb/r/partition_upgrade_5727_mac_lctn_2_debug.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ test/table_part_cap_6#p#p1 Single
302302
test/table_part_cap_6#p#p2 Single
303303
test/table_part_cap_6#p#p3 Single
304304
test/table_part_cap_6#p#p4 Single
305-
test/table_part_NOPART_CAP_7 General
305+
test/table_part_nopart_cap_7 General
306306
test/table_part_sub_1#p#part_1#sp#part_1sp0 Single
307307
test/table_part_sub_1#p#part_1#sp#part_1sp1 Single
308308
test/table_part_sub_1#p#part_2#sp#part_2sp0 Single
@@ -1386,7 +1386,7 @@ test/table_part_cap_6#p#p1 Single
13861386
test/table_part_cap_6#p#p2 Single
13871387
test/table_part_cap_6#p#p3 Single
13881388
test/table_part_cap_6#p#p4 Single
1389-
test/table_part_NOPART_CAP_7 General
1389+
test/table_part_nopart_cap_7 General
13901390
test/table_part_sub_1#p#part_1#sp#part_1sp0 Single
13911391
test/table_part_sub_1#p#part_1#sp#part_1sp1 Single
13921392
test/table_part_sub_1#p#part_2#sp#part_2sp0 Single

mysql-test/suite/innodb/r/partition_upgrade_5727_win_lctn_2_debug.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ test/table_part_cap_6#p#p1 Single
302302
test/table_part_cap_6#p#p2 Single
303303
test/table_part_cap_6#p#p3 Single
304304
test/table_part_cap_6#p#p4 Single
305-
test/table_part_NOPART_CAP_7 General
305+
test/table_part_nopart_cap_7 General
306306
test/table_part_sub_1#p#part_1#sp#part_1sp0 Single
307307
test/table_part_sub_1#p#part_1#sp#part_1sp1 Single
308308
test/table_part_sub_1#p#part_2#sp#part_2sp0 Single
@@ -1386,7 +1386,7 @@ test/table_part_cap_6#p#p1 Single
13861386
test/table_part_cap_6#p#p2 Single
13871387
test/table_part_cap_6#p#p3 Single
13881388
test/table_part_cap_6#p#p4 Single
1389-
test/table_part_NOPART_CAP_7 General
1389+
test/table_part_nopart_cap_7 General
13901390
test/table_part_sub_1#p#part_1#sp#part_1sp0 Single
13911391
test/table_part_sub_1#p#part_1#sp#part_1sp1 Single
13921392
test/table_part_sub_1#p#part_2#sp#part_2sp0 Single

storage/innobase/dict/dict0dd.cc

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -440,39 +440,46 @@ int dd_table_open_on_dd_obj(THD *thd, dd::cache::Dictionary_client *client,
440440

441441
TABLE_SHARE ts;
442442
TABLE table_def;
443-
dd::Schema *schema;
444443

445444
error =
446445
acquire_uncached_table(thd, client, &dd_table, tbl_name, &ts, &table_def);
447446
if (error != 0) {
448447
return (error);
449448
}
450449

451-
char tmp_name[MAX_FULL_NAME_LEN + 1];
452-
const char *tab_namep;
453-
if (tbl_name) {
454-
tab_namep = tbl_name;
455-
} else {
456-
char tmp_schema[MAX_DATABASE_NAME_LEN + 1];
457-
char tmp_tablename[MAX_TABLE_NAME_LEN + 1];
450+
const char *table_name = tbl_name;
451+
if (!tbl_name) {
452+
dd::Schema *schema;
458453
error = client->acquire_uncached<dd::Schema>(dd_table.schema_id(), &schema);
459454
if (error != 0) {
460455
return error;
461456
}
462-
tablename_to_filename(schema->name().c_str(), tmp_schema,
463-
MAX_DATABASE_NAME_LEN + 1);
464-
tablename_to_filename(dd_table.name().c_str(), tmp_tablename,
465-
MAX_TABLE_NAME_LEN + 1);
466-
snprintf(tmp_name, sizeof tmp_name, "%s/%s", tmp_schema, tmp_tablename);
467-
tab_namep = tmp_name;
457+
458+
bool truncated;
459+
char tmp_name[FN_REFLEN + 1];
460+
build_table_filename(tmp_name, sizeof(tmp_name) - 1, schema->name().c_str(),
461+
dd_table.name().c_str(), nullptr, 0, &truncated);
462+
463+
if (truncated) {
464+
ut_d(ut_error);
465+
ut_o(return DB_TOO_LONG_PATH);
466+
}
467+
table_name = tmp_name;
468+
}
469+
470+
char norm_name[FN_REFLEN];
471+
if (!normalize_table_name(norm_name, table_name)) {
472+
ut_d(ut_error);
473+
ut_o(return DB_TOO_LONG_PATH);
468474
}
475+
469476
if (dd_part == nullptr) {
470-
table = dd_open_table(client, &table_def, tab_namep, &dd_table, thd);
477+
table = dd_open_table(client, &table_def, norm_name, &dd_table, thd);
471478
if (table == nullptr) {
472479
error = HA_ERR_GENERIC;
473480
}
474481
} else {
475-
table = dd_open_table(client, &table_def, tab_namep, dd_part, thd);
482+
table = dd_open_table(client, &table_def, norm_name, dd_part, thd);
476483
}
477484
release_uncached_table(&ts, &table_def);
478485
return error;

0 commit comments

Comments
 (0)