mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#50201: Server crashes in explain_filename on an InnoDB partitioned table
Problem was that in mysql-trunk the ER() macro is now dependent on current_thd and the innodb monitor thread has no binding to that thd object. This cause the crash because of bad derefencing. Solution was to add a new macro which take the thd as an argument (which the innodb thread uses for the call). (Updated according to reviewers comments, i.e. added ER_THD_OR_DEFAULT and moved test to suite parts.)
This commit is contained in:
@ -291,7 +291,8 @@ uint explain_filename(THD* thd,
|
||||
{
|
||||
if (explain_mode == EXPLAIN_ALL_VERBOSE)
|
||||
{
|
||||
to_p= strnmov(to_p, ER(ER_DATABASE_NAME), end_p - to_p);
|
||||
to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_DATABASE_NAME),
|
||||
end_p - to_p);
|
||||
*(to_p++)= ' ';
|
||||
to_p= add_identifier(thd, to_p, end_p, db_name, db_name_len);
|
||||
to_p= strnmov(to_p, ", ", end_p - to_p);
|
||||
@ -304,7 +305,7 @@ uint explain_filename(THD* thd,
|
||||
}
|
||||
if (explain_mode == EXPLAIN_ALL_VERBOSE)
|
||||
{
|
||||
to_p= strnmov(to_p, ER(ER_TABLE_NAME), end_p - to_p);
|
||||
to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_TABLE_NAME), end_p - to_p);
|
||||
*(to_p++)= ' ';
|
||||
to_p= add_identifier(thd, to_p, end_p, table_name, table_name_len);
|
||||
}
|
||||
@ -321,18 +322,22 @@ uint explain_filename(THD* thd,
|
||||
if (name_type != NORMAL)
|
||||
{
|
||||
if (name_type == TEMP)
|
||||
to_p= strnmov(to_p, ER(ER_TEMPORARY_NAME), end_p - to_p);
|
||||
to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_TEMPORARY_NAME),
|
||||
end_p - to_p);
|
||||
else
|
||||
to_p= strnmov(to_p, ER(ER_RENAMED_NAME), end_p - to_p);
|
||||
to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_RENAMED_NAME),
|
||||
end_p - to_p);
|
||||
to_p= strnmov(to_p, " ", end_p - to_p);
|
||||
}
|
||||
to_p= strnmov(to_p, ER(ER_PARTITION_NAME), end_p - to_p);
|
||||
to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_PARTITION_NAME),
|
||||
end_p - to_p);
|
||||
*(to_p++)= ' ';
|
||||
to_p= add_identifier(thd, to_p, end_p, part_name, part_name_len);
|
||||
if (subpart_name)
|
||||
{
|
||||
to_p= strnmov(to_p, ", ", end_p - to_p);
|
||||
to_p= strnmov(to_p, ER(ER_SUBPARTITION_NAME), end_p - to_p);
|
||||
to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_SUBPARTITION_NAME),
|
||||
end_p - to_p);
|
||||
*(to_p++)= ' ';
|
||||
to_p= add_identifier(thd, to_p, end_p, subpart_name, subpart_name_len);
|
||||
}
|
||||
|
Reference in New Issue
Block a user