post-merge fixes
test SHOW OPEN TABLES mysql-test/r/show_check.result: updated result mysql-test/t/show_check.test: test show open tables sql/mysql_priv.h: post-merge fixes sql/sql_base.cc: post-merge fixes sql/sql_parse.cc: post-merge fixes
This commit is contained in:
parent
8aac0529c7
commit
24638d06bd
@ -90,3 +90,6 @@ t1 CREATE TABLE `t1` (
|
|||||||
`a` int(11) NOT NULL default '0',
|
`a` int(11) NOT NULL default '0',
|
||||||
PRIMARY KEY (`a`)
|
PRIMARY KEY (`a`)
|
||||||
) TYPE=MyISAM
|
) TYPE=MyISAM
|
||||||
|
Open_tables_in_test Comment
|
||||||
|
Open_tables_in_test Comment
|
||||||
|
t1 cached=1, in_use=0
|
||||||
|
@ -72,3 +72,10 @@ drop table t1;
|
|||||||
create table t1 (a int not null, primary key (a));
|
create table t1 (a int not null, primary key (a));
|
||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
flush tables;
|
||||||
|
show open tables;
|
||||||
|
create table t1(n int);
|
||||||
|
insert into t1 values (1);
|
||||||
|
show open tables;
|
||||||
|
drop table t1;
|
||||||
|
@ -45,6 +45,7 @@ char *sql_strmake(const char *str,uint len);
|
|||||||
gptr sql_memdup(const void * ptr,unsigned size);
|
gptr sql_memdup(const void * ptr,unsigned size);
|
||||||
void sql_element_free(void *ptr);
|
void sql_element_free(void *ptr);
|
||||||
void kill_one_thread(THD *thd, ulong id);
|
void kill_one_thread(THD *thd, ulong id);
|
||||||
|
char* query_table_status(THD *thd,const char *db,const char *table_name);
|
||||||
|
|
||||||
#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
|
#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
|
||||||
#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
|
#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
|
||||||
@ -373,7 +374,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
|
|||||||
|
|
||||||
/* sql_list.c */
|
/* sql_list.c */
|
||||||
int mysqld_show_dbs(THD *thd,const char *wild);
|
int mysqld_show_dbs(THD *thd,const char *wild);
|
||||||
int mysqld_show_open_tables(THD *thd,const char *wild);
|
int mysqld_show_open_tables(THD *thd,const char *db,const char *wild);
|
||||||
int mysqld_show_tables(THD *thd,const char *db,const char *wild);
|
int mysqld_show_tables(THD *thd,const char *db,const char *wild);
|
||||||
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
|
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
|
||||||
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
|
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
|
||||||
@ -450,7 +451,8 @@ bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
|
|||||||
void copy_field_from_tmp_record(Field *field,int offset);
|
void copy_field_from_tmp_record(Field *field,int offset);
|
||||||
int fill_record(List<Item> &fields,List<Item> &values);
|
int fill_record(List<Item> &fields,List<Item> &values);
|
||||||
int fill_record(Field **field,List<Item> &values);
|
int fill_record(Field **field,List<Item> &values);
|
||||||
OPEN_TABLE_LIST *list_open_tables(THD *thd,const char *wild);
|
int list_open_tables(THD *thd,List<char> *tables, const char *db,
|
||||||
|
const char *wild);
|
||||||
|
|
||||||
/* sql_calc.cc */
|
/* sql_calc.cc */
|
||||||
bool eval_const_cond(COND *cond);
|
bool eval_const_cond(COND *cond);
|
||||||
|
@ -34,8 +34,6 @@ HASH open_cache; /* Used by mysql_test */
|
|||||||
|
|
||||||
static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
|
static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
|
||||||
const char *name, const char *alias, bool locked);
|
const char *name, const char *alias, bool locked);
|
||||||
static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
|
|
||||||
const char *table_name, List_iterator<Item> *it);
|
|
||||||
static void free_cache_entry(TABLE *entry);
|
static void free_cache_entry(TABLE *entry);
|
||||||
static void mysql_rm_tmp_tables(void);
|
static void mysql_rm_tmp_tables(void);
|
||||||
static key_map get_key_map_from_key_list(TABLE *table,
|
static key_map get_key_map_from_key_list(TABLE *table,
|
||||||
@ -407,6 +405,47 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
|
|||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* move one table to free list */
|
||||||
|
|
||||||
|
bool close_thread_table(THD *thd, TABLE **table_ptr)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("close_thread_table");
|
||||||
|
|
||||||
|
bool found_old_table=0;
|
||||||
|
TABLE *table=*table_ptr;
|
||||||
|
|
||||||
|
*table_ptr=table->next;
|
||||||
|
if (table->version != refresh_version ||
|
||||||
|
thd->version != refresh_version || !table->db_stat)
|
||||||
|
{
|
||||||
|
VOID(hash_delete(&open_cache,(byte*) table));
|
||||||
|
found_old_table=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (table->flush_version != flush_version)
|
||||||
|
{
|
||||||
|
table->flush_version=flush_version;
|
||||||
|
table->file->extra(HA_EXTRA_FLUSH);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Free memory and reset for next loop
|
||||||
|
table->file->extra(HA_EXTRA_RESET);
|
||||||
|
}
|
||||||
|
table->in_use=0;
|
||||||
|
if (unused_tables)
|
||||||
|
{
|
||||||
|
table->next=unused_tables; /* Link in last */
|
||||||
|
table->prev=unused_tables->prev;
|
||||||
|
unused_tables->prev=table;
|
||||||
|
table->prev->next=table;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
unused_tables=table->next=table->prev=table;
|
||||||
|
}
|
||||||
|
DBUG_RETURN(found_old_table);
|
||||||
|
}
|
||||||
|
|
||||||
/* Put all tables used by thread in free list */
|
/* Put all tables used by thread in free list */
|
||||||
|
|
||||||
@ -1832,7 +1871,7 @@ static key_map get_key_map_from_key_list(TABLE *table,
|
|||||||
** Returns pointer to last inserted field if ok
|
** Returns pointer to last inserted field if ok
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static bool
|
bool
|
||||||
insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
|
insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
|
||||||
const char *table_name, List_iterator<Item> *it)
|
const char *table_name, List_iterator<Item> *it)
|
||||||
{
|
{
|
||||||
|
@ -1819,6 +1819,7 @@ mysql_execute_command(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case SQLCOM_SHOW_TABLES:
|
case SQLCOM_SHOW_TABLES:
|
||||||
|
case SQLCOM_SHOW_OPEN_TABLES:
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
||||||
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
||||||
@ -1840,7 +1841,10 @@ mysql_execute_command(void)
|
|||||||
if (check_access(thd,SELECT_ACL,db,&thd->col_access))
|
if (check_access(thd,SELECT_ACL,db,&thd->col_access))
|
||||||
goto error; /* purecov: inspected */
|
goto error; /* purecov: inspected */
|
||||||
/* grant is checked in mysqld_show_tables */
|
/* grant is checked in mysqld_show_tables */
|
||||||
if (select_lex->options & SELECT_DESCRIBE)
|
if (lex->sql_command == SQLCOM_SHOW_OPEN_TABLES)
|
||||||
|
res= mysqld_show_open_tables(thd, db,
|
||||||
|
(lex->wild ? lex->wild->ptr() : NullS));
|
||||||
|
else if (select_lex->options & SELECT_DESCRIBE)
|
||||||
res= mysqld_extend_show_tables(thd,db,
|
res= mysqld_extend_show_tables(thd,db,
|
||||||
(lex->wild ? lex->wild->ptr() : NullS));
|
(lex->wild ? lex->wild->ptr() : NullS));
|
||||||
else
|
else
|
||||||
@ -1849,9 +1853,6 @@ mysql_execute_command(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case SQLCOM_SHOW_OPEN_TABLES:
|
|
||||||
res= mysqld_show_open_tables(thd,(lex->wild ? lex->wild->ptr() : NullS));
|
|
||||||
break;
|
|
||||||
case SQLCOM_SHOW_FIELDS:
|
case SQLCOM_SHOW_FIELDS:
|
||||||
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
||||||
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user