1
# we are assuming the memcached binary is contained in PATH or
2
# common directories we might expect it to be in
3
--exec sh $TOP_BUILDDIR/plugin/memcached_query_cache/start_mc.sh stop
4
--exec sh $TOP_BUILDDIR/plugin/memcached_query_cache/start_mc.sh start
7
DROP TABLE IF EXISTS `t1`;
8
DROP TABLE IF EXISTS `t2`;
11
--replace_result $MC_PORT MC_A_PORT
12
set global query_cache_servers= "127.0.0.1:$MC_PORT";
13
set query_cache_enable= on;
14
CREATE TABLE `t1` (id integer NOT NULL auto_increment primary key, name varchar(20), age int);
16
INSERT INTO `t1` (name, age) values ("leila", 20);
17
INSERT INTO `t1` (name, age) values ("lockman", 2);
18
INSERT INTO `t1` (name, age) values ("ali", 22);
19
INSERT INTO `t1` (name, age) values ("Meriem", NULL);
21
CREATE TABLE `t2` (id int auto_increment primary key) select * from `t1` where age > 20;
24
select * from t1, t2 where t1.name = t2.name;
25
select t.table from data_dictionary.query_cached_tables t;
26
select d.schema, d.sql from data_dictionary.query_cache_entries d;
28
#Test the invalidation BY
31
INSERT INTO `t1` (name, age) values ("Foued", 35);
32
select t.table from data_dictionary.query_cached_tables t;
33
select d.schema, d.sql from data_dictionary.query_cache_entries d;
36
UPDATE `t2` set age= age + 4;
37
select t.table from data_dictionary.query_cached_tables t;
38
select d.schema, d.sql from data_dictionary.query_cache_entries d;
42
select query_cache_flush();
45
select * from t1, t2 where t1.name = t2.name;
46
select t.table from data_dictionary.query_cached_tables t;
47
select d.schema, d.sql from data_dictionary.query_cache_entries d;
48
delete from t1 where name= "ali";
49
select t.table from data_dictionary.query_cached_tables t;
50
select d.schema, d.sql from data_dictionary.query_cache_entries d;
52
#4: ALTER (replication of this statement is not working)
53
##select query_cache_flush();
56
##select * from t1, t2 where t1.name = t2.name;
57
##select t.table from data_dictionary.query_cached_tables t;
58
##select d.schema, d.sql from data_dictionary.query_cache_entries d;
59
##ALTER TABLE `t2` add column (education varchar(20) default "Phd");
60
##select t.table from data_dictionary.query_cached_tables t;
61
##select d.schema, d.sql from data_dictionary.query_cache_entries d;
64
select query_cache_flush();
67
select * from t1, t2 where t1.name = t2.name;
68
select t.table from data_dictionary.query_cached_tables t;
69
select d.schema, d.sql from data_dictionary.query_cache_entries d;
71
select t.table from data_dictionary.query_cached_tables t;
72
select d.schema, d.sql from data_dictionary.query_cache_entries d;
75
--exec sh $TOP_BUILDDIR/plugin/memcached_query_cache/start_mc.sh stop