List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:October 5 2011 10:30am
Subject:bzr push into mysql-trunk branch (sergey.glukhov:3479 to 3480)
View as plain text  
 3480 Sergey Glukhov	2011-10-05 [merge]
      automerge

 3479 Sergey Glukhov	2011-10-05 [merge]
      automerge
     @ storage/innobase/include/sync0rw.ic
        automerge
     @ storage/innobase/sync/sync0rw.c
        automerge

    modified:
      storage/innobase/include/sync0rw.ic
      storage/innobase/sync/sync0rw.c
=== modified file 'mysql-test/r/error_simulation.result'
--- a/mysql-test/r/error_simulation.result	2011-06-24 12:53:57 +0000
+++ b/mysql-test/r/error_simulation.result	2011-10-05 10:19:50 +0000
@@ -83,5 +83,18 @@ a	a	b	filler
 SET SESSION debug = DEFAULT;
 DROP TABLE t1, t2;
 #
+# Bug#11747970 34660: CRASH WHEN FEDERATED TABLE LOSES CONNECTION DURING INSERT ... SELECT
+#
+CREATE TABLE t1(f1 INT, KEY(f1));
+CREATE TABLE t2(f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SET SESSION debug='d,bug11747970_simulate_error';
+INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
+Warnings:
+Error	1105	Unknown error
+SET SESSION debug = DEFAULT;
+DROP TABLE t1,t2;
+#
 # End of 5.1 tests
 #

=== modified file 'mysql-test/t/error_simulation.test'
--- a/mysql-test/t/error_simulation.test	2010-06-30 09:17:27 +0000
+++ b/mysql-test/t/error_simulation.test	2011-10-05 09:55:51 +0000
@@ -89,6 +89,20 @@ SET SESSION debug = DEFAULT;
 
 DROP TABLE t1, t2;
 
+
+--echo #
+--echo # Bug#11747970 34660: CRASH WHEN FEDERATED TABLE LOSES CONNECTION DURING INSERT ... SELECT
+--echo #
+CREATE TABLE t1(f1 INT, KEY(f1));
+CREATE TABLE t2(f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SET SESSION debug='d,bug11747970_simulate_error';
+INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
+SET SESSION debug = DEFAULT;
+DROP TABLE t1,t2;
+
+
 --echo #
 --echo # End of 5.1 tests
 --echo #

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2011-09-29 13:25:22 +0000
+++ b/sql/item_subselect.cc	2011-10-05 10:19:50 +0000
@@ -2171,7 +2171,7 @@ subselect_single_select_engine(st_select
 			       select_result_interceptor *result_arg,
 			       Item_subselect *item_arg)
   :subselect_engine(item_arg, result_arg),
-   prepared(0), executed(0), select_lex(select), join(0)
+   prepared(0), executed(0), optimize_error(0), select_lex(select), join(0)
 {
   select_lex->master_unit()->item= item_arg;
 }
@@ -2180,7 +2180,7 @@ subselect_single_select_engine(st_select
 void subselect_single_select_engine::cleanup()
 {
   DBUG_ENTER("subselect_single_select_engine::cleanup");
-  prepared= executed= 0;
+  prepared= executed= optimize_error= false;
   join= 0;
   result->cleanup();
   DBUG_VOID_RETURN;
@@ -2392,6 +2392,10 @@ int join_read_next_same_or_null(READ_REC
 bool subselect_single_select_engine::exec()
 {
   DBUG_ENTER("subselect_single_select_engine::exec");
+
+  if (optimize_error)
+    DBUG_RETURN(true);
+
   int rc= 0;
   THD * const thd= item->unit->thd;
   char const *save_where= thd->where;
@@ -2402,9 +2406,13 @@ bool subselect_single_select_engine::exe
     SELECT_LEX_UNIT *unit= select_lex->master_unit();
 
     unit->set_limit(unit->global_parameters);
+
+    DBUG_EXECUTE_IF("bug11747970_simulate_error",
+                    DBUG_SET("+d,bug11747970_raise_error"););
+
     if (join->optimize())
     {
-      executed= true;
+      optimize_error= true;
       rc= join->error ? join->error : 1;
       goto exit;
     }

=== modified file 'sql/item_subselect.h'
--- a/sql/item_subselect.h	2011-09-29 12:47:32 +0000
+++ b/sql/item_subselect.h	2011-10-05 10:19:50 +0000
@@ -526,6 +526,7 @@ class subselect_single_select_engine: pu
 private:
   bool prepared; /* simple subselect is prepared */
   bool executed; /* simple subselect is executed */
+  bool optimize_error; ///< simple subselect optimization failed
   st_select_lex *select_lex; /* corresponding select_lex */
   JOIN * join; /* corresponding JOIN structure */
 public:

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-10-04 14:02:34 +0000
+++ b/sql/sql_select.cc	2011-10-05 10:19:50 +0000
@@ -4994,6 +4994,16 @@ make_join_statistics(JOIN *join, TABLE_L
     table_vector[i]=s->table=table=tables->table;
     table->pos_in_table_list= tables;
     error= tables->fetch_number_of_rows();
+
+    DBUG_EXECUTE_IF("bug11747970_raise_error",
+                    {
+                      if (!error)
+                      {
+                        my_error(ER_UNKNOWN_ERROR, MYF(0));
+                        goto error;
+                      }
+                    });
+
     if (error)
     {
       table->file->print_error(error, MYF(0));

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (sergey.glukhov:3479 to 3480) Sergey Glukhov5 Oct