List:Internals« Previous MessageNext Message »
From:ahristov Date:August 8 2005 10:59pm
Subject:bk commit into 5.0 tree (andrey:1.1963) BUG#12183
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of andrey. When andrey does a push these changes will
be propagated 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://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1963 05/08/08 22:58:57 andrey@lmy004. +5 -0
  fix for bug #12183
  "SHOW OPEN TABLES behavior doesn't match grammar"

  sql/sql_show.cc
    1.263 05/08/08 22:58:51 andrey@lmy004. +2 -1
    pass the DB if specified

  sql/sql_base.cc
    1.276 05/08/08 22:58:51 andrey@lmy004. +5 -4
    first check against the db if present (SHOW OPEN FILES FROM xxx)
    then do wild compare but only against the table name

  sql/mysql_priv.h
    1.339 05/08/08 22:58:51 andrey@lmy004. +1 -1
    pass the name of the database for checking

  mysql-test/t/show_check.test
    1.52 05/08/08 22:58:51 andrey@lmy004. +18 -0
    test the extended functionality (so far not documented) of SHOW OPEN FILES

  mysql-test/r/show_check.result
    1.72 05/08/08 22:56:59 andrey@lmy004. +43 -0
    test the extended functionality (so far not documented) of SHOW OPEN FILES

# 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:	andrey
# Host:	lmy004.
# Root:	/home/andrey/mysql-5.0-bug12183

--- 1.338/sql/mysql_priv.h	2005-08-07 23:32:24 +02:00
+++ 1.339/sql/mysql_priv.h	2005-08-08 22:58:51 +02:00
@@ -981,7 +981,7 @@
                                           bool ignore_errors,
                                           Table_triggers_list *triggers,
                                           enum trg_event_type event);
-OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild);
+OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild);
 
 inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table,
                                              const char *db_name,

--- 1.275/sql/sql_base.cc	2005-08-03 05:44:29 +02:00
+++ 1.276/sql/sql_base.cc	2005-08-08 22:58:51 +02:00
@@ -129,12 +129,11 @@
     #		Pointer to list of names of open tables.
 */
 
-OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
+OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
 {
   int result = 0;
   OPEN_TABLE_LIST **start_list, *open_list;
   TABLE_LIST table_list;
-  char name[NAME_LEN*2];
   DBUG_ENTER("list_open_tables");
 
   VOID(pthread_mutex_lock(&LOCK_open));
@@ -151,10 +150,12 @@
     DBUG_ASSERT(share->table_name != 0);
     if ((!share->table_name))			// To be removed
       continue;					// Shouldn't happen
+    if (db && my_strcasecmp(system_charset_info, db, share->table_cache_key))
+      continue;
+
     if (wild)
     {
-      strxmov(name,share->table_cache_key,".",share->table_name,NullS);
-      if (wild_compare(name,wild,0))
+      if (wild_compare(share->table_name,wild,0))
 	continue;
     }
 

--- 1.262/sql/sql_show.cc	2005-08-07 23:32:25 +02:00
+++ 1.263/sql/sql_show.cc	2005-08-08 22:58:51 +02:00
@@ -3170,7 +3170,8 @@
   TABLE *table= tables->table;
   CHARSET_INFO *cs= system_charset_info;
   OPEN_TABLE_LIST *open_list;
-  if (!(open_list=list_open_tables(thd,wild)) && thd->is_fatal_error)
+  if (!(open_list=list_open_tables(thd,thd->lex->select_lex.db, wild))
+            && thd->is_fatal_error)
     DBUG_RETURN(1);
 
   for (; open_list ; open_list=open_list->next)

--- 1.71/mysql-test/r/show_check.result	2005-07-07 18:49:06 +02:00
+++ 1.72/mysql-test/r/show_check.result	2005-08-08 22:56:59 +02:00
@@ -512,3 +512,46 @@
   KEY `c2` USING BTREE (`c2`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1;
+CREATE TABLE txt1(a int);
+CREATE TABLE tyt2(a int);
+CREATE TABLE urkunde(a int);
+FLUSH TABLES;
+SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name,
txt1, tyt2, urkunde LIMIT 0;
+1
+SHOW OPEN TABLES;
+Database	Table	In_use	Name_locked
+mysql	db	0	0
+test	urkunde	0	0
+mysql	time_zone	0	0
+mysql	user	0	0
+test	txt1	0	0
+mysql	proc	0	0
+test	tyt2	0	0
+mysql	time_zone_name	0	0
+SHOW OPEN TABLES FROM mysql;
+Database	Table	In_use	Name_locked
+mysql	db	0	0
+mysql	time_zone	0	0
+mysql	user	0	0
+mysql	proc	0	0
+mysql	time_zone_name	0	0
+SHOW OPEN TABLES FROM mysql LIKE 'u%';
+Database	Table	In_use	Name_locked
+mysql	user	0	0
+SHOW OPEN TABLES LIKE 't%';
+Database	Table	In_use	Name_locked
+mysql	time_zone	0	0
+test	txt1	0	0
+test	tyt2	0	0
+mysql	time_zone_name	0	0
+SHOW OPEN TABLES LIKE '%o%';
+Database	Table	In_use	Name_locked
+mysql	time_zone	0	0
+mysql	proc	0	0
+mysql	time_zone_name	0	0
+FLUSH TABLES;
+SHOW OPEN TABLES;
+Database	Table	In_use	Name_locked
+DROP TABLE txt1;
+DROP TABLE tyt2;
+DROP TABLE urkunde;

--- 1.51/mysql-test/t/show_check.test	2005-07-28 15:12:37 +02:00
+++ 1.52/mysql-test/t/show_check.test	2005-08-08 22:58:51 +02:00
@@ -387,3 +387,21 @@
 DROP TABLE t1;
 
 # End of 4.1 tests
+#
+# BUG 12183 -  SHOW OPEN TABLES behavior doesn't match grammar
+# First we close all open tables with FLUSH tables and then we open some.
+CREATE TABLE txt1(a int);
+CREATE TABLE tyt2(a int);
+CREATE TABLE urkunde(a int);
+FLUSH TABLES;
+SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name,
txt1, tyt2, urkunde LIMIT 0;
+SHOW OPEN TABLES;
+SHOW OPEN TABLES FROM mysql;
+SHOW OPEN TABLES FROM mysql LIKE 'u%';
+SHOW OPEN TABLES LIKE 't%';
+SHOW OPEN TABLES LIKE '%o%';
+FLUSH TABLES;
+SHOW OPEN TABLES;
+DROP TABLE txt1;
+DROP TABLE tyt2;
+DROP TABLE urkunde;
Thread
bk commit into 5.0 tree (andrey:1.1963) BUG#12183ahristov8 Aug