Commit 8ce74569 authored by Davi Arnaut's avatar Davi Arnaut
Browse files

Cherry-pick Bug#33362 from mysql-5.1

parent 436f1dc4
Loading
Loading
Loading
Loading
+1672 −0

File changed.

Preview size limit exceeded, changes collapsed.

+56 −0
Original line number Diff line number Diff line
@@ -38,3 +38,59 @@ drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t2
SET @@global.query_cache_size=0;

# End of 4.1 tests

#
# Bug#33362: Query cache invalidation (truncate) may hang if cached query uses many tables
#

let $c= 255;

while ($c)
{
  eval CREATE TABLE t$c (a INT);
  eval INSERT INTO t$c VALUES ($c);
  dec $c;
}

let $c= 254;
let $str= t255;

while ($c)
{
  let $str= t$c,$str;
  dec $c;
}

eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str);
SET GLOBAL query_cache_size = 1048576;
FLUSH STATUS;
SELECT a FROM t0 WHERE a = 1;
SHOW STATUS LIKE "Qcache_queries_in_cache";

let $c= 255;
let $i= 1;

FLUSH TABLES;

while ($c)
{
  eval TRUNCATE TABLE t$c;
  eval SELECT a FROM t$i;
  dec $c;
  inc $i;
}

SELECT a FROM t0;
DROP TABLE t0;

let $c= 255;

while ($c)
{
  eval DROP TABLE t$c;
  dec $c;
}

SET @@global.query_cache_size = 0;

--echo End of 5.1 tests
+1 −1
Original line number Diff line number Diff line
@@ -2516,7 +2516,7 @@ my_bool Query_cache::register_all_tables(Query_cache_block *block,
	 tmp++)
      unlink_table(tmp);
  }
  return (n);
  return test(n);
}

/*