[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-internals
Subject:    bk commit into 5.0 tree (1.1471)
From:       pem () mysql ! com
Date:       2003-02-28 14:07:21
[Download RAW message or body]

Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1471 03/02/28 15:07:14 pem@mysql.com +5 -0
  Closing tables during SP execution the proper way.

  sql/sql_class.cc
    1.109 03/02/28 15:07:12 pem@mysql.com +0 -27
    Removed closing of tables in various send_eof() methods again.

  sql/sp_head.cc
    1.14 03/02/28 15:07:12 pem@mysql.com +5 -0
    Close tables after each sub statement.

  sql/sp.cc
    1.7 03/02/28 15:07:12 pem@mysql.com +11 -9
    Fixed closing of tables.

  mysql-test/r/status.result
    1.5 03/02/28 15:07:12 pem@mysql.com +1 -1
    proc table now shows up in different places.

  mysql-test/r/show_check.result
    1.32 03/02/28 15:07:12 pem@mysql.com +1 -0
    proc table now shows up in different places.

# 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:	pem
# Host:	mysql.telia.com
# Root:	/home/pem/work/mysql-5.0

--- 1.108/sql/sql_class.cc	Wed Feb 19 12:42:31 2003
+++ 1.109/sql/sql_class.cc	Fri Feb 28 15:07:12 2003
@@ -801,15 +801,6 @@
 
 bool select_export::send_eof()
 {
-  /* This mimics select_send::send_eof(), which unlocks this way.
-   * It appears to be necessary, since tables aren't unlock after
-   * selects otherwise.
-   */
-  if (thd->lock)
-  {
-    mysql_unlock_tables(thd, thd->lock);
-    thd->lock=0;
-  }
   int error=test(end_io_cache(&cache));
   if (my_close(file,MYF(MY_WME)))
     error=1;
@@ -920,15 +911,6 @@
 
 bool select_dump::send_eof()
 {
-  /* This mimics select_send::send_eof(), which unlocks this way.
-   * It appears to be necessary, since tables aren't unlock after
-   * selects otherwise.
-   */
-  if (thd->lock)
-  {
-    mysql_unlock_tables(thd, thd->lock);
-    thd->lock=0;
-  }
   int error=test(end_io_cache(&cache));
   if (my_close(file,MYF(MY_WME)))
     error=1;
@@ -1061,15 +1043,6 @@
 
 bool select_dumpvar::send_eof()
 {
-  /* This mimics select_send::send_eof(), which unlocks this way.
-   * It appears to be necessary, since tables aren't unlock after
-   * selects otherwise.
-   */
-  if (thd->lock)
-  {
-    mysql_unlock_tables(thd, thd->lock);
-    thd->lock=0;
-  }
   if (row_count)
   {
     ::send_ok(thd,row_count);

--- 1.31/mysql-test/r/show_check.result	Sat Feb  8 01:09:17 2003
+++ 1.32/mysql-test/r/show_check.result	Fri Feb 28 15:07:12 2003
@@ -127,6 +127,7 @@
 show open tables;
 Database	Table	In_use	Name_locked
 test	t1	0	0
+mysql	proc	0	0
 drop table t1;
 create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 \
CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 \
DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;  show create table t1;

--- 1.6/sql/sp.cc	Wed Feb 26 19:22:27 2003
+++ 1.7/sql/sp.cc	Fri Feb 28 15:07:12 2003
@@ -50,13 +50,16 @@
   tables.db= (char*)"mysql";
   tables.real_name= tables.alias= (char*)"proc";
   if (! (table= open_ltable(thd, &tables, ltype)))
+  {
+    *tablep= NULL;
     DBUG_RETURN(SP_OPEN_TABLE_FAILED);
+  }
 
   if (table->file->index_read_idx(table->record[0], 0,
 				  key, keylen,
 				  HA_READ_KEY_EXACT))
   {
-    close_thread_tables(thd);
+    *tablep= NULL;
     DBUG_RETURN(SP_KEY_NOT_FOUND);
   }
   *tablep= table;
@@ -94,7 +97,7 @@
     *sphp= tmplex->sphead;
 
  done:
-  if (ret != SP_OK && table)
+  if (table)
     close_thread_tables(thd);
   DBUG_RETURN(ret);
 }
@@ -129,8 +132,7 @@
       ret= SP_OK;
   }
 
-  if (ret == SP_OK && table)
-    close_thread_tables(thd);
+  close_thread_tables(thd);
   DBUG_RETURN(ret);
 }
 
@@ -149,8 +151,7 @@
       ret= SP_DELETE_ROW_FAILED;
   }
 
-  if (ret == SP_OK && table)
-    close_thread_tables(thd);
+  close_thread_tables(thd);
   DBUG_RETURN(ret);
 }
 
@@ -251,12 +252,13 @@
 sp_function_exists(THD *thd, LEX_STRING *name)
 {
   TABLE *table;
+  bool ret= FALSE;
 
   if (db_find_routine_aux(thd, TYPE_ENUM_FUNCTION,
 			  name->str, name->length, TL_READ, &table) == SP_OK)
   {
-    close_thread_tables(thd);
-    return TRUE;
+    ret= TRUE;
   }
-  return FALSE;
+  close_thread_tables(thd);
+  return ret;
 }

--- 1.13/sql/sp_head.cc	Thu Feb 27 19:08:50 2003
+++ 1.14/sql/sp_head.cc	Fri Feb 28 15:07:12 2003
@@ -415,6 +415,11 @@
   thd->lex.thd = thd;
 
   res= mysql_execute_command(thd);
+  if (thd->lock || thd->open_tables || thd->derived_tables)
+  {
+    thd->proc_info="closing tables";
+    close_thread_tables(thd);			/* Free tables */
+  }
 
   memcpy(&thd->lex, &olex, sizeof(LEX)); // Restore the other lex
 

--- 1.4/mysql-test/r/status.result	Thu Oct 11 02:59:45 2001
+++ 1.5/mysql-test/r/status.result	Fri Feb 28 15:07:12 2003
@@ -14,6 +14,6 @@
 unlock tables;
 show status like 'Table_lock%';
 Variable_name	Value
-Table_locks_immediate	3
+Table_locks_immediate	4
 Table_locks_waited	1
 drop table t1;

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail internals-thread7226@lists.mysql.com
To unsubscribe, e-mail <internals-unsubscribe@lists.mysql.com>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic