MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:November 14 2006 4:50pm
Subject:bk commit into 5.0 tree (evgen:1.2304) BUG#20045
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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@stripped, 2006-11-14 19:50:44+03:00, evgen@stripped +3 -0
  Bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view 
  
  The regression is caused by the fix for bug 14767. When INSERT ... SELECT
  used a view in the SELECT list that was not inlined, and there was an 
  active transaction, the server could crash in Query_cache::invalidate.
  
  On INSERT ... SELECT only the table being inserted into is invalidated.
  Thus views that can't be inlined are skipped from invalidation.
  
  The bug manifests itself in two ways so there is 2 test cases.
  One checks that the only the table being inserted into is invalidated.
  And the second one checks that there is no crash on INSERT ... SELECT.

  mysql-test/r/query_cache.result@stripped, 2006-11-14 19:46:59+03:00, evgen@stripped +48 -0
    Added a test case for bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view

  mysql-test/t/query_cache.test@stripped, 2006-11-14 19:46:21+03:00, evgen@stripped +29 -0
    Added a test case for bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view

  sql/sql_parse.cc@stripped, 2006-11-14 19:47:14+03:00, evgen@stripped +4 -0
    Bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view 
    On INSERT ... SELECT only the table being inserted into is invalidated.

# 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:	evgen
# Host:	moonbone.local
# Root:	/work/20045-bug-5.0-opt-mysql

--- 1.582/sql/sql_parse.cc	2006-10-03 13:38:13 +04:00
+++ 1.583/sql/sql_parse.cc	2006-11-14 19:47:14 +03:00
@@ -3421,8 +3421,12 @@
         if (first_table->lock_type ==  TL_WRITE_CONCURRENT_INSERT &&
             thd->lock)
         {
+          /* INSERT ... SELECT should invalidate only the very first table */
+          TABLE_LIST *save_table= first_table->next_local;
+          first_table->next_local= 0;
           mysql_unlock_tables(thd, thd->lock);
           query_cache_invalidate3(thd, first_table, 1);
+          first_table->next_local= save_table;
           thd->lock=0;
         }
         delete result;

--- 1.75/mysql-test/r/query_cache.result	2006-09-26 13:57:50 +04:00
+++ 1.76/mysql-test/r/query_cache.result	2006-11-14 19:46:59 +03:00
@@ -1274,3 +1274,51 @@
 Last_query_cost	0.000000
 drop table t1;
 SET GLOBAL query_cache_size=0;
+set global query_cache_size=1024*1024;
+flush status;
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3);
+select * from t1;
+a
+1
+2
+3
+show status like 'Qcache_hits';
+Variable_name	Value
+Qcache_hits	0
+select * from t1;
+a
+1
+2
+3
+show status like 'Qcache_hits';
+Variable_name	Value
+Qcache_hits	1
+create table t2 like t1;
+select * from t1;
+a
+1
+2
+3
+show status like 'Qcache_hits';
+Variable_name	Value
+Qcache_hits	2
+insert into t2 select * from t1;
+select * from t1;
+a
+1
+2
+3
+show status like 'Qcache_hits';
+Variable_name	Value
+Qcache_hits	3
+drop table t1, t2;
+create table t1(c1 int);
+create table t2(c1 int);
+create table t3(c1 int);
+create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1;
+start transaction;
+insert into t1(c1) select c1 from v1;
+drop table t1, t2, t3;
+drop view v1;
+set global query_cache_size=0;

--- 1.54/mysql-test/t/query_cache.test	2006-02-24 19:34:08 +03:00
+++ 1.55/mysql-test/t/query_cache.test	2006-11-14 19:46:21 +03:00
@@ -870,3 +870,32 @@
 show status like 'last_query_cost';
 drop table t1;
 SET GLOBAL query_cache_size=0;
+
+#
+# Bug #20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view
+#
+set global query_cache_size=1024*1024;
+flush status;
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3);
+select * from t1;
+show status like 'Qcache_hits';
+select * from t1;
+show status like 'Qcache_hits';
+create table t2 like t1;
+select * from t1;
+show status like 'Qcache_hits';
+insert into t2 select * from t1;
+select * from t1;
+show status like 'Qcache_hits';
+drop table t1, t2;
+
+create table t1(c1 int);
+create table t2(c1 int);
+create table t3(c1 int);
+create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1;
+start transaction;
+insert into t1(c1) select c1 from v1;
+drop table t1, t2, t3;
+drop view v1;
+set global query_cache_size=0;
Thread
bk commit into 5.0 tree (evgen:1.2304) BUG#20045eugene14 Nov