Below is the list of changes that have just been committed into a
4.0 repository of sasha. When sasha does a push, they will be propogated to
the main repository and within 24 hours after the push to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet@stripped, 2001-07-07 19:15:41-06:00, sasha@stripped
post-merge fixes
test SHOW OPEN TABLES
mysql-test/r/show_check.result
1.9 01/07/07 17:48:27 sasha@stripped +3 -0
updated result
mysql-test/t/show_check.test
1.10 01/07/07 17:48:27 sasha@stripped +7 -0
test show open tables
sql/mysql_priv.h
1.109 01/07/07 17:48:27 sasha@stripped +4 -2
post-merge fixes
sql/sql_base.cc
1.85 01/07/07 17:48:27 sasha@stripped +42 -3
post-merge fixes
sql/sql_parse.cc
1.144 01/07/07 17:48:27 sasha@stripped +5 -4
post-merge fixes
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: sasha
# Host: mysql.sashanet.com
# Root: /home/sasha/src/bk/mysql-4.0
--- 1.108/sql/mysql_priv.h Mon Jun 25 02:35:22 2001
+++ 1.109/sql/mysql_priv.h Sat Jul 7 17:48:27 2001
@@ -45,6 +45,7 @@
gptr sql_memdup(const void * ptr,unsigned size);
void sql_element_free(void *ptr);
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 safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
@@ -373,7 +374,7 @@
/* sql_list.c */
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_extend_show_tables(THD *thd,const char *db,const char *wild);
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
@@ -450,7 +451,8 @@
void copy_field_from_tmp_record(Field *field,int offset);
int fill_record(List<Item> &fields,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 */
bool eval_const_cond(COND *cond);
--- 1.84/sql/sql_base.cc Sat Jul 7 15:35:23 2001
+++ 1.85/sql/sql_base.cc Sat Jul 7 17:48:27 2001
@@ -34,8 +34,6 @@
static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
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 mysql_rm_tmp_tables(void);
static key_map get_key_map_from_key_list(TABLE *table,
@@ -407,6 +405,47 @@
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 */
@@ -1832,7 +1871,7 @@
** Returns pointer to last inserted field if ok
****************************************************************************/
-static bool
+bool
insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
const char *table_name, List_iterator<Item> *it)
{
--- 1.143/sql/sql_parse.cc Wed Jul 4 17:14:29 2001
+++ 1.144/sql/sql_parse.cc Sat Jul 7 17:48:27 2001
@@ -1819,6 +1819,7 @@
}
#endif
case SQLCOM_SHOW_TABLES:
+ case SQLCOM_SHOW_OPEN_TABLES:
/* FALL THROUGH */
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
@@ -1840,7 +1841,10 @@
if (check_access(thd,SELECT_ACL,db,&thd->col_access))
goto error; /* purecov: inspected */
/* 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,
(lex->wild ? lex->wild->ptr() : NullS));
else
@@ -1849,9 +1853,6 @@
break;
}
#endif
- case SQLCOM_SHOW_OPEN_TABLES:
- res= mysqld_show_open_tables(thd,(lex->wild ? lex->wild->ptr() : NullS));
- break;
case SQLCOM_SHOW_FIELDS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
--- 1.8/mysql-test/r/show_check.result Thu Jun 21 01:50:14 2001
+++ 1.9/mysql-test/r/show_check.result Sat Jul 7 17:48:27 2001
@@ -90,3 +90,6 @@
`a` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) TYPE=MyISAM
+Open_tables_in_test Comment
+Open_tables_in_test Comment
+t1 cached=1, in_use=0
--- 1.9/mysql-test/t/show_check.test Thu Jun 21 01:50:14 2001
+++ 1.10/mysql-test/t/show_check.test Sat Jul 7 17:48:27 2001
@@ -72,3 +72,10 @@
create table t1 (a int not null, primary key (a));
show create 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;
| Thread |
|---|
| • bk commit into 4.0 tree | sasha | 8 Jul |