List:Commits« Previous MessageNext Message »
From:konstantin Date:July 18 2006 9:43pm
Subject:bk commit into 5.0 tree (kostja:1.2237) BUG#20045
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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-07-18 23:43:08+04:00, kostja@stripped +3 -0
  A fix and a test case for Bug#20045 "cache invalidate crashes when 
  INSERT .. SELECT the query uses a VIEW".
  
  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.
  The fix is to exclude views from invalidate list of query cache.
  
  QQQ: Why does INSERT .. SELECT causes invalidation of all tables, not 
  just the first one?

  mysql-test/r/query_cache.result@stripped, 2006-07-18 23:43:05+04:00, kostja@stripped +13
-0
    Test results fixed (Bug#20045)

  mysql-test/t/query_cache.test@stripped, 2006-07-18 23:43:05+04:00, kostja@stripped +21 -1
    Add a test case for Bug#20045 "Qcache invalidate crashes when 
    INSERT .. SELECT the query uses a VIEW.

  sql/sql_cache.cc@stripped, 2006-07-18 23:43:05+04:00, kostja@stripped +3 -2
    Invalidate the table only if it's a base table.

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

--- 1.92/sql/sql_cache.cc	2006-07-18 23:43:16 +04:00
+++ 1.93/sql/sql_cache.cc	2006-07-18 23:43:16 +04:00
@@ -1252,8 +1252,9 @@ void Query_cache::invalidate(THD *thd, T
 	(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
       for (; tables_used; tables_used= tables_used->next_local)
       {
-	DBUG_ASSERT(!using_transactions || tables_used->table!=0);
-	if (tables_used->derived)
+	DBUG_ASSERT(!using_transactions || tables_used->table != NULL ||
+                    tables_used->view);
+	if (tables_used->derived || tables_used->view)
 	  continue;
 	if (using_transactions &&
 	   (tables_used->table->file->table_cache_type() ==

--- 1.72/mysql-test/r/query_cache.result	2006-07-18 23:43:16 +04:00
+++ 1.73/mysql-test/r/query_cache.result	2006-07-18 23:43:16 +04:00
@@ -1252,6 +1252,7 @@ drop procedure f3;
 drop procedure f4;
 drop table t1;
 set GLOBAL query_cache_size=0;
+End of 4.1 tests
 SET GLOBAL query_cache_size=102400;
 create table t1(a int);
 insert into t1 values(0), (1), (4), (5);
@@ -1267,4 +1268,16 @@ show status like 'last_query_cost';
 Variable_name	Value
 Last_query_cost	0.000000
 drop table t1;
+drop table if exists t1, t2, t3;
+drop view if exists v1;
+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;
+insert into t1(c1) select c1 from v1;
+drop table t1, t2, t3;
+drop view v1;
+End of 5.0 tests
 SET GLOBAL query_cache_size=0;

--- 1.54/mysql-test/t/query_cache.test	2006-07-18 23:43:16 +04:00
+++ 1.55/mysql-test/t/query_cache.test	2006-07-18 23:43:16 +04:00
@@ -856,7 +856,7 @@ drop procedure f4;
 drop table t1;
 set GLOBAL query_cache_size=0;
 
-# End of 4.1 tests
+--echo End of 4.1 tests
 
 #
 # Bug #10303: problem with last_query_cost
@@ -869,4 +869,24 @@ select * from t1 where a > 3;
 select * from t1 where a > 3;
 show status like 'last_query_cost';
 drop table t1;
+
+#
+# Bug#20045 "Qcache invalidate crashes when INSERT .. SELECT the query uses
+#            a VIEW"
+#
+--disable_warnings
+drop table if exists t1, t2, t3;
+drop view if exists v1;
+--enable_warnings
+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;
+insert into t1(c1) select c1 from v1;
+drop table t1, t2, t3;
+drop view v1;
+
+--echo End of 5.0 tests
 SET GLOBAL query_cache_size=0;
Thread
bk commit into 5.0 tree (kostja:1.2237) BUG#20045konstantin18 Jul