~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/query_cache_merge.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Test query cache with many tables
 
2
 
 
3
--source include/have_query_cache.inc
 
4
let $LIMIT=`SHOW VARIABLES LIKE 'open_files_limit'`;
 
5
let $MIN_LIMIT=600;
 
6
let $MAX_LIMIT=65536;
 
7
--source include/check_var_limit.inc
 
8
 
 
9
SET @@global.query_cache_size=1355776;
 
10
 
 
11
#
 
12
# more then 255 (257) merged tables test
 
13
#
 
14
 
 
15
flush status;
 
16
disable_query_log;
 
17
--disable_warnings
 
18
let $1 = 257;
 
19
while ($1)
 
20
{
 
21
  eval drop table if exists t$1;
 
22
  eval create table t$1(a int);
 
23
  eval insert into t$1 values (1),(2);
 
24
  dec $1;
 
25
}
 
26
--enable_warnings
 
27
 
 
28
#
 
29
# In order for the test to pass in --ps-protocol, we must
 
30
# set table_definition_cache size to at least 258 elements.
 
31
# Otherwise table versions are bound to change between
 
32
# prepare and execute, and we will get a constant validation
 
33
# error. See WL#4165 for details.
 
34
#
 
35
set @save_table_definition_cache= @@global.table_definition_cache;
 
36
set @@global.table_definition_cache=512;
 
37
create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
 
38
enable_query_log;
 
39
select count(*) from t00;
 
40
select count(*) from t00;
 
41
show status like "Qcache_queries_in_cache";
 
42
show status like "Qcache_hits";
 
43
delete from t256;
 
44
show status like "Qcache_queries_in_cache";
 
45
drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
 
46
 
 
47
SET @@global.query_cache_size=0;
 
48
set @@global.table_definition_cache=@save_table_definition_cache;
 
49
 
 
50
# End of 4.1 tests
 
51
 
 
52
#
 
53
# Bug#33362: Query cache invalidation (truncate) may hang if cached query uses many tables
 
54
#
 
55
 
 
56
SET @save_table_definition_cache = @@global.table_definition_cache;
 
57
SET @@global.table_definition_cache = 512;
 
58
 
 
59
let $c= 255;
 
60
 
 
61
while ($c)
 
62
{
 
63
  eval CREATE TABLE t$c (a INT);
 
64
  eval INSERT INTO t$c VALUES ($c);
 
65
  dec $c;
 
66
}
 
67
 
 
68
let $c= 254;
 
69
let $str= t255;
 
70
 
 
71
while ($c)
 
72
{
 
73
  let $str= t$c,$str;
 
74
  dec $c;
 
75
}
 
76
 
 
77
eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str);
 
78
SET GLOBAL query_cache_size = 1048576;
 
79
FLUSH STATUS;
 
80
SELECT a FROM t0 WHERE a = 1;
 
81
SHOW STATUS LIKE "Qcache_queries_in_cache";
 
82
 
 
83
let $c= 255;
 
84
let $i= 1;
 
85
 
 
86
while ($c)
 
87
{
 
88
  eval TRUNCATE TABLE t$c;
 
89
  eval SELECT a FROM t$i;
 
90
  dec $c;
 
91
  inc $i;
 
92
}
 
93
 
 
94
SELECT a FROM t0;
 
95
DROP TABLE t0;
 
96
 
 
97
let $c= 255;
 
98
 
 
99
while ($c)
 
100
{
 
101
  eval DROP TABLE t$c;
 
102
  dec $c;
 
103
}
 
104
 
 
105
SET @@global.query_cache_size = 0;
 
106
SET @@global.table_definition_cache = @save_table_definition_cache;
 
107
 
 
108
--echo End of 5.1 tests