List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:April 27 2006 10:11pm
Subject:bk commit into 5.0 tree (aelkin:1.2101) BUG#19188
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of elkin. When elkin 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.2101 06/04/27 23:11:13 aelkin@stripped +3 -0
  Bug#19188: incorrect temporary table name of DROP query in 
  replication
  
  Auxiliary part of the fix to refine "not-by-user-create-temp-table" condition.

  sql/sql_base.cc
    1.334 06/04/27 23:11:05 aelkin@stripped +16 -9
    refine non-by-user-created table definition according to
    a mysql_priv.h's declaration.

  mysql-test/t/rpl_temporary.test
    1.19 06/04/27 23:11:05 aelkin@stripped +1 -1
    a correct not-user created name: one that starts with #sql

  mysql-test/r/rpl_temporary.result
    1.24 06/04/27 23:11:05 aelkin@stripped +1 -1
    results changed

# 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:	aelkin
# Host:	dsl-hkigw8-feb0de00-199.dhcp.inet.fi
# Root:	/net/nb/home/elkin/MySQL/FIXES/5.0-bug_tmp_file_prefix

--- 1.333/sql/sql_base.cc	2006-04-23 21:30:01 +03:00
+++ 1.334/sql/sql_base.cc	2006-04-27 23:11:05 +03:00
@@ -607,6 +607,12 @@
   DBUG_VOID_RETURN;
 }
 
+/* close_temporary_tables' internal */
+static inline bool is_user_table(const char *check)
+{
+  return strncmp(check, tmp_file_prefix, strlen(tmp_file_prefix));
+}
+
 /* close_temporary_tables' internal, 4 is due to uint4korr definition */
 static inline uint  tmpkeyval(THD *thd, TABLE *table)
 {
@@ -636,7 +642,7 @@
   */
   for (prev_table= thd->temporary_tables, 
          table= prev_table->next,
-         found_user_tables= (prev_table->s->table_name[0] != '#'); 
+         found_user_tables= is_user_table(prev_table->s->table_name); 
        table;
        prev_table= table, table= table->next)
   {
@@ -647,16 +653,17 @@
       Fixme/todo: nothing (I checked the manual) prevents user to create temp
       with `#' 
     */
-    if (table->s->table_name[0] == '#')
-      continue;
-    else 
+    if (is_user_table(table->s->table_name))
     {
       found_user_tables = 1;
     }
+    else 
+      continue;
     for (prev_sorted= NULL, sorted= thd->temporary_tables; sorted != table; 
          prev_sorted= sorted, sorted= sorted->next)
     {
-      if (sorted->s->table_name[0] == '#' || tmpkeyval(thd, sorted) >
tmpkeyval(thd, table))
+      if (!is_user_table(sorted->s->table_name) ||
+          tmpkeyval(thd, sorted) > tmpkeyval(thd, table))
       {
         /* move into the sorted part of the list from the unsorted */
         prev_table->next= table->next;
@@ -680,12 +687,12 @@
      all implicitly created temp tables
   */
   for (max_names_len= 0, table=thd->temporary_tables; 
-       table && table->s->table_name[0] != '#';
+       table && is_user_table(table->s->table_name);
        table=table->next)
   {
     uint tmp_names_len;
     for (tmp_names_len= table->s->key_length + 1;
-         table->next && table->s->table_name[0] != '#' &&
+         table->next && is_user_table(table->s->table_name) &&
            tmpkeyval(thd, table) == tmpkeyval(thd, table->next);
          table=table->next)
     {
@@ -709,7 +716,7 @@
   for (table=thd->temporary_tables; table; table= next)
   {
     if (query // we might be out of memory, but this is not fatal 
-        && table->s->table_name[0] != '#') 
+        && is_user_table(table->s->table_name)) 
     {
       char *end_cur;
       /* Set pseudo_thread_id to be that of the processed table */
@@ -717,7 +724,7 @@
       /* Loop forward through all tables within the sublist of
          common pseudo_thread_id to create single DROP query */
       for (end_cur= end;
-           table && table->s->table_name[0] != '#' &&
+           table && is_user_table(table->s->table_name) &&
              tmpkeyval(thd, table) == thd->variables.pseudo_thread_id;
            table= next)
       {

--- 1.23/mysql-test/r/rpl_temporary.result	2006-04-23 20:06:24 +03:00
+++ 1.24/mysql-test/r/rpl_temporary.result	2006-04-27 23:11:05 +03:00
@@ -108,7 +108,7 @@
 create temporary table t102 (id int);
 set @session.pseudo_thread_id=200;
 create temporary table t201 (id int);
-create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int);
+create temporary table `#sql_not_user_created` (id int);
 set @con1_id=connection_id();
 kill @con1_id;
 create table t1(f int);

--- 1.18/mysql-test/t/rpl_temporary.test	2006-04-23 20:06:24 +03:00
+++ 1.19/mysql-test/t/rpl_temporary.test	2006-04-27 23:11:05 +03:00
@@ -168,7 +168,7 @@
 create temporary table t102 (id int);
 set @session.pseudo_thread_id=200;
 create temporary table t201 (id int);
-create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int);
+create temporary table `#sql_not_user_created` (id int);
 set @con1_id=connection_id();
 kill @con1_id;
 
Thread
bk commit into 5.0 tree (aelkin:1.2101) BUG#19188Andrei Elkin27 Apr