MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Elliot Murphy Date:June 17 2005 3:15pm
Subject:bk commit into 4.1 tree (elliot:1.2301) BUG#10442
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of emurphy. When emurphy 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.2301 05/06/17 11:15:29 elliot@stripped +3 -0
  BUG#10442 Fix replication slave crash when a query with multiupdate and 
  subselects is used.

  sql/sql_parse.cc
    1.444 05/06/17 11:15:25 elliot@stripped +8 -8
    BUG#10442 Fix crash on replication slave by making sure that table list
    is filled out before it is used.

  mysql-test/r/rpl_multi_update3.result
    1.1 05/06/16 16:32:31 elliot@stripped +42 -0

  mysql-test/r/rpl_multi_update3.result
    1.0 05/06/16 16:32:31 elliot@stripped +0 -0
    BitKeeper file /Users/emurphy/src/work/mysql-4.1-bug10442/mysql-test/r/rpl_multi_update3.result

  mysql-test/t/rpl_multi_update3.test
    1.1 05/06/16 16:31:14 elliot@stripped +33 -0

  mysql-test/t/rpl_multi_update3.test
    1.0 05/06/16 16:31:14 elliot@stripped +0 -0
    BitKeeper file /Users/emurphy/src/work/mysql-4.1-bug10442/mysql-test/t/rpl_multi_update3.test

# 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:	elliot
# Host:	agony.local
# Root:	/Users/emurphy/src/work/mysql-4.1-bug10442

--- 1.443/sql/sql_parse.cc	2005-06-16 16:11:40 -04:00
+++ 1.444/sql/sql_parse.cc	2005-06-17 11:15:25 -04:00
@@ -1943,6 +1943,14 @@
   if (tables || &lex->select_lex != lex->all_selects_list)
     mysql_reset_errors(thd);
 
+  /* When subselects or time_zone info is used in a query
+   * we create a new TABLE_LIST containing all referenced tables
+   * and set local variable 'tables' to point to this list. */
+  if ((&lex->select_lex != lex->all_selects_list ||
+       lex->time_zone_tables_used) &&
+      lex->unit.create_total_list(thd, lex, &tables))
+    DBUG_VOID_RETURN;
+
 #ifdef HAVE_REPLICATION
   if (thd->slave_thread)
   {
@@ -1992,14 +2000,6 @@
 #endif
   }
 #endif /* !HAVE_REPLICATION */
-
-  /* When subselects or time_zone info is used in a query
-   * we create a new TABLE_LIST containing all referenced tables
-   * and set local variable 'tables' to point to this list. */
-  if ((&lex->select_lex != lex->all_selects_list ||
-       lex->time_zone_tables_used) &&
-      lex->unit.create_total_list(thd, lex, &tables))
-    DBUG_VOID_RETURN;
 
   /*
     When option readonly is set deny operations which change tables.
--- New file ---
+++ mysql-test/r/rpl_multi_update3.result	05/06/16 16:32:31
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=MyISAM;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
a	b
1	0
2	0
SELECT * FROM t2 ORDER BY a;
a	b
1	0
2	1
UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
SELECT * FROM t1 ORDER BY a;
a	b
1	0
2	0
SELECT * FROM t2 ORDER BY a;
a	b
1	6
2	6
SELECT * FROM t1 ORDER BY a;
a	b
1	0
2	0
SELECT * FROM t2 ORDER BY a;
a	b
1	6
2	6

--- New file ---
+++ mysql-test/t/rpl_multi_update3.test	05/06/16 16:31:14
# Let's verify that multi-update with a subselect does not cause the slave to crash
# (BUG#10442)

source include/master-slave.inc;

CREATE TABLE t1 (
 a int unsigned not null auto_increment primary key,
 b int unsigned
) ENGINE=MyISAM;

CREATE TABLE t2 (
 a int unsigned not null auto_increment primary key,
 b int unsigned
) ENGINE=MyISAM;

INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;

INSERT INTO t2 VALUES (NULL, 0), (NULL,1);

SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;

UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;

save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;


Thread
bk commit into 4.1 tree (elliot:1.2301) BUG#10442Elliot Murphy17 Jun