mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
fixed bug on re-open of temp tables after FLUSH in the middle of open
added flush test case, but had to comment the fun part out because it does not work for some reason - will investigate why. sql/sql_base.cc: fixed bugs on re-open of temp tables after FLUSH in the middle of open
This commit is contained in:
parent
fc9c0ad83e
commit
250bb75a50
3 changed files with 24 additions and 0 deletions
2
mysql-test/r/flush.result
Normal file
2
mysql-test/r/flush.result
Normal file
|
@ -0,0 +1,2 @@
|
|||
n
|
||||
3
|
12
mysql-test/t/flush.test
Normal file
12
mysql-test/t/flush.test
Normal file
|
@ -0,0 +1,12 @@
|
|||
connect (con1,localhost,root,,test,0,mysql-master.sock);
|
||||
connect (con2,localhost,root,,test,0,mysql-master.sock);
|
||||
connection con1;
|
||||
drop table if exists t1;
|
||||
create temporary table t1(n int);
|
||||
connection con2;
|
||||
#send flush tables;
|
||||
connection con1;
|
||||
insert into t1 values(3);
|
||||
select * from t1;
|
||||
connection con2;
|
||||
#reap;
|
|
@ -32,6 +32,7 @@
|
|||
TABLE *unused_tables; /* Used by mysql_test */
|
||||
HASH open_cache; /* Used by mysql_test */
|
||||
|
||||
static void reset_query_id_on_temp_tables(THD* thd);
|
||||
|
||||
static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
|
||||
const char *name, const char *alias, bool locked);
|
||||
|
@ -1314,6 +1315,12 @@ err:
|
|||
}
|
||||
|
||||
|
||||
static void reset_query_id_on_temp_tables(THD* thd)
|
||||
{
|
||||
for(TABLE* tmp = thd->temporary_tables; tmp; tmp = tmp->next)
|
||||
tmp->query_id = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
** open all tables in list
|
||||
*****************************************************************************/
|
||||
|
@ -1339,6 +1346,9 @@ int open_tables(THD *thd,TABLE_LIST *start)
|
|||
{
|
||||
/* close all 'old' tables used by this thread */
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
// if query_id is not reset, we will get an error
|
||||
// re-opening a temp table
|
||||
reset_query_id_on_temp_tables(thd);
|
||||
thd->version=refresh_version;
|
||||
TABLE **prev_table= &thd->open_tables;
|
||||
bool found=0;
|
||||
|
|
Loading…
Add table
Reference in a new issue