summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-12-06 01:05:30 +0200
committermonty@hundin.mysql.fi <>2001-12-06 01:05:30 +0200
commit4c17825acd56ccbbf7e6649e7ebe98c34f992c84 (patch)
treeb6eaff9c9c574324b7a2aae18f5de2e52f89576c /mysql-test
parent40da50460543ee76d70b727506bf0676be9bcd52 (diff)
downloadmariadb-git-4c17825acd56ccbbf7e6649e7ebe98c34f992c84.tar.gz
Update of query cache code
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/flush.result5
-rw-r--r--mysql-test/r/query_cache.result38
-rw-r--r--mysql-test/t/flush.test9
-rw-r--r--mysql-test/t/query_cache-master.opt1
-rw-r--r--mysql-test/t/query_cache.test26
5 files changed, 79 insertions, 0 deletions
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index 1fb4fc05136..99d212ee49c 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -28,3 +28,8 @@ select * from t1;
n
345
drop table t1;
+flush query cache;
+reset query cache;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
new file mode 100644
index 00000000000..ac6962bfd9d
--- /dev/null
+++ b/mysql-test/r/query_cache.result
@@ -0,0 +1,38 @@
+reset query cache;
+flush status;
+drop table if exists t1;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+select sql_no_cache * from t1;
+a
+1
+2
+3
+select length(now()) from t1;
+length(now())
+19
+19
+19
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+drop table t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index fe219471041..6a09b903873 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -66,3 +66,12 @@ connection con2;
insert into t1 values (345);
select * from t1;
drop table t1;
+
+#
+# Test that QUERY CACHE commands doesn't core dump.
+# (Normally we don't have a cache active at this point)
+#
+
+flush query cache;
+reset query cache;
+show status like "Qcache_queries_in_cache";
diff --git a/mysql-test/t/query_cache-master.opt b/mysql-test/t/query_cache-master.opt
new file mode 100644
index 00000000000..7ff962c2216
--- /dev/null
+++ b/mysql-test/t/query_cache-master.opt
@@ -0,0 +1 @@
+--set-variable=query_cache_size=2M
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
new file mode 100644
index 00000000000..3d1aa70d8b2
--- /dev/null
+++ b/mysql-test/t/query_cache.test
@@ -0,0 +1,26 @@
+#
+# Tests with query cache
+#
+
+# Reset query cache variables.
+
+reset query cache;
+flush status;
+drop table if exists t1;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+select * from t1;
+select sql_no_cache * from t1;
+select length(now()) from t1;
+
+# Only check the variables that are independent of the machine and startup
+# options
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+drop table t1;
+
+show status like "Qcache_queries_in_cache";