mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix removal of tables from cache when the database they are contained
within is dropped and lower_case_table_names is set. (Bug #8355)
This commit is contained in:
@ -141,3 +141,21 @@ select * from T1;
|
|||||||
a b
|
a b
|
||||||
1 abc
|
1 abc
|
||||||
drop table T1;
|
drop table T1;
|
||||||
|
create database mysqltest_LC2;
|
||||||
|
use mysqltest_LC2;
|
||||||
|
create table myUC (i int);
|
||||||
|
insert into myUC values (1),(2),(3);
|
||||||
|
select * from myUC;
|
||||||
|
i
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
use test;
|
||||||
|
drop database mysqltest_LC2;
|
||||||
|
create database mysqltest_LC2;
|
||||||
|
use mysqltest_LC2;
|
||||||
|
create table myUC (i int);
|
||||||
|
select * from myUC;
|
||||||
|
i
|
||||||
|
use test;
|
||||||
|
drop database mysqltest_LC2;
|
||||||
|
@ -111,3 +111,20 @@ select * from T1;
|
|||||||
alter table T1 add index (a);
|
alter table T1 add index (a);
|
||||||
select * from T1;
|
select * from T1;
|
||||||
drop table T1;
|
drop table T1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #8355: Tables not dropped from table cache on drop db
|
||||||
|
#
|
||||||
|
create database mysqltest_LC2;
|
||||||
|
use mysqltest_LC2;
|
||||||
|
create table myUC (i int);
|
||||||
|
insert into myUC values (1),(2),(3);
|
||||||
|
select * from myUC;
|
||||||
|
use test;
|
||||||
|
drop database mysqltest_LC2;
|
||||||
|
create database mysqltest_LC2;
|
||||||
|
use mysqltest_LC2;
|
||||||
|
create table myUC (i int);
|
||||||
|
select * from myUC;
|
||||||
|
use test;
|
||||||
|
drop database mysqltest_LC2;
|
||||||
|
@ -750,7 +750,7 @@ bool close_temporary_table(THD *thd, const char *db, const char *table_name);
|
|||||||
void close_temporary(TABLE *table, bool delete_table=1);
|
void close_temporary(TABLE *table, bool delete_table=1);
|
||||||
bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
|
bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
|
||||||
const char *table_name);
|
const char *table_name);
|
||||||
void remove_db_from_cache(const my_string db);
|
void remove_db_from_cache(const char *db);
|
||||||
void flush_tables();
|
void flush_tables();
|
||||||
bool remove_table_from_cache(THD *thd, const char *db, const char *table,
|
bool remove_table_from_cache(THD *thd, const char *db, const char *table,
|
||||||
bool return_if_owned_by_thd=0);
|
bool return_if_owned_by_thd=0);
|
||||||
|
@ -2864,8 +2864,18 @@ static void mysql_rm_tmp_tables(void)
|
|||||||
** and afterwards delete those marked unused.
|
** and afterwards delete those marked unused.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void remove_db_from_cache(const my_string db)
|
void remove_db_from_cache(const char *db)
|
||||||
{
|
{
|
||||||
|
char name_buff[NAME_LEN+1];
|
||||||
|
if (db && lower_case_table_names)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
convert database to lower case for comparision.
|
||||||
|
*/
|
||||||
|
strmake(name_buff, db, sizeof(name_buff)-1);
|
||||||
|
my_casedn_str(files_charset_info, name_buff);
|
||||||
|
db= name_buff;
|
||||||
|
}
|
||||||
for (uint idx=0 ; idx < open_cache.records ; idx++)
|
for (uint idx=0 ; idx < open_cache.records ; idx++)
|
||||||
{
|
{
|
||||||
TABLE *table=(TABLE*) hash_element(&open_cache,idx);
|
TABLE *table=(TABLE*) hash_element(&open_cache,idx);
|
||||||
|
Reference in New Issue
Block a user