diff options
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/drop.test | 38 | ||||
-rw-r--r-- | mysql-test/t/flush.test | 12 | ||||
-rw-r--r-- | mysql-test/t/grant_cache-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/grant_cache.test | 102 | ||||
-rw-r--r-- | mysql-test/t/innodb.test | 18 | ||||
-rw-r--r-- | mysql-test/t/query_cache.test | 12 |
6 files changed, 143 insertions, 40 deletions
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index faf0a1a31b4..c92f2b1f3b9 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -11,33 +11,33 @@ create table t1(n int); drop table t1; select * from t1; -#now test for a bug in drop database - it is important that the name -#of the table is the same as the name of the database - in the original -#code this triggered a bug -drop database if exists foo; -create database foo; -drop database if exists foo; -create database foo; -create table foo.foo (n int); -insert into foo.foo values (4); -select * from foo.foo; -drop database if exists foo; -create database foo; -drop database foo; +# now test for a bug in drop database - it is important that the name +# of the table is the same as the name of the database - in the original +# code this triggered a bug +drop database if exists mysqltest; +create database mysqltest; +drop database if exists mysqltest; +create database mysqltest; +create table mysqltest.mysqltest (n int); +insert into mysqltest.mysqltest values (4); +select * from mysqltest.mysqltest; +drop database if exists mysqltest; +create database mysqltest; +drop database mysqltest; # test drop/create database and FLUSH TABLES WITH READ LOCK -drop database if exists foo; +drop database if exists mysqltest; flush tables with read lock; --error 1209,1223; -create database foo; +create database mysqltest; unlock tables; -create database foo; +create database mysqltest; show databases; flush tables with read lock; --error 1208,1223; -drop database foo; +drop database mysqltest; unlock tables; -drop database foo; +drop database mysqltest; show databases; --error 1008 -drop database foo; +drop database mysqltest; diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 6a09b903873..38aa37caa4f 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -44,15 +44,15 @@ reap; #test if drop database will wait until we release the global read lock connection con1; -drop database if exists foo; -create database foo; -create table foo.t1(n int); -insert into foo.t1 values (23); +drop database if exists mysqltest; +create database mysqltest; +create table mysqltest.t1(n int); +insert into mysqltest.t1 values (23); flush tables with read lock; connection con2; -send drop database foo; +send drop database mysqltest; connection con1; -select * from foo.t1; +select * from mysqltest.t1; unlock tables; connection con2; reap; diff --git a/mysql-test/t/grant_cache-master.opt b/mysql-test/t/grant_cache-master.opt new file mode 100644 index 00000000000..cfdce628e74 --- /dev/null +++ b/mysql-test/t/grant_cache-master.opt @@ -0,0 +1 @@ +--set-variable=query_cache_size=1355776 diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test new file mode 100644 index 00000000000..a6c878cc31c --- /dev/null +++ b/mysql-test/t/grant_cache.test @@ -0,0 +1,102 @@ +# +# Test grants with query cache +# +drop table if exists test.t1,mysqltest.t1,mysqltest.t2; +reset query cache; +flush status; +connect (root,localhost,root,,test,0,master.sock); +connection root; +create database if not exists mysqltest; + +create table mysqltest.t1 (a int,b int,c int); +create table mysqltest.t2 (a int,b int,c int); +insert into mysqltest.t1 values (1,1,1),(2,2,2); +insert into mysqltest.t2 values (3,3,3); +create table test.t1 (a char (10)); +insert into test.t1 values ("test.t1"); +select * from t1; +connect (root2,localhost,root,,mysqltest,0,master.sock); +connection root2; +# put queries in cache +select * from t1; +select a from t1; +select c from t1; +select * from t2; +select * from mysqltest.t1,test.t1; +show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits%"; + +# Create the test users +grant SELECT on mysqltest.* to mysqltest_1@localhost; +grant SELECT on mysqltest.t1 to mysqltest_2@localhost; +grant SELECT on test.t1 to mysqltest_2@localhost; +grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; + +# The following queries should be fetched from cache +connect (user1,localhost,mysqltest_1,,mysqltest,0,master.sock); +connection user1; +select "user1"; +select * from t1; +# The pre and end space are intentional + select a from t1 ; +select c from t1; +show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_not_cached"; + +# The following queries should be fetched from cache +connect (user2,localhost,mysqltest_2,,mysqltest,0,master.sock); +connection user2; +select "user2"; +select * from t1; +select a from t1; +select c from t1; +select * from mysqltest.t1,test.t1; +--error 1142 +select * from t2; +show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_not_cached"; + +# The following queries should not be fetched from cache +connect (user3,localhost,mysqltest_3,,mysqltest,0,master.sock); +connection user3; +select "user3"; +--error 1143 +select * from t1; +select a from t1; +--error 1143 +select c from t1; +--error 1142 +select * from t2; +--error 1143 +select mysqltest.t1.c from test.t1,mysqltest.t1; +show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_not_cached"; + +# Connect without a database +connect (user4,localhost,mysqltest_1,,*NO-ONE*,0,master.sock); +connection user4; +select "user4"; +--error 1046 +select a from t1; +# The following query is not cached before (different database) +select * from mysqltest.t1,test.t1; +# Cache a query with 'no database' +select a from mysqltest.t1; +select a from mysqltest.t1; +show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_not_cached"; + +# Cleanup + +connection root; +delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3"); +delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3"); +delete from mysql.tables_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3"); +delete from mysql.columns_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3"); +flush privileges; +drop table test.t1,mysqltest.t1,mysqltest.t2; +drop database mysqltest; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 36bcad1db3c..68617e99b31 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -518,18 +518,18 @@ drop table t1; # Test DROP DATABASE # -create database test_$1; -create table test_$1.t1 (a int not null) type= innodb; -insert into test_$1.t1 values(1); -create table test_$1.t2 (a int not null) type= myisam; -insert into test_$1.t2 values(1); -create table test_$1.t3 (a int not null) type= heap; -insert into test_$1.t3 values(1); +create database mysqltest; +create table mysqltest.t1 (a int not null) type= innodb; +insert into mysqltest.t1 values(1); +create table mysqltest.t2 (a int not null) type= myisam; +insert into mysqltest.t2 values(1); +create table mysqltest.t3 (a int not null) type= heap; +insert into mysqltest.t3 values(1); commit; -drop database test_$1; +drop database mysqltest; # Don't check error message --error 12,12 -show tables from test_$1; +show tables from mysqltest; # # Test truncate table diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index b22814f2fd9..955abeaabc4 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -235,17 +235,17 @@ drop table t1,t2; # # noncachable ODBC work around (and prepare cache for drop database) # -create database foo; -create table foo.t1 (i int not null auto_increment, a int, primary key (i)); -insert into foo.t1 (a) values (1); -select * from foo.t1 where i is null; +create database mysqltest; +create table mysqltest.t1 (i int not null auto_increment, a int, primary key (i)); +insert into mysqltest.t1 (a) values (1); +select * from mysqltest.t1 where i is null; # # drop db # -select * from foo.t1; +select * from mysqltest.t1; show status like "Qcache_queries_in_cache"; -drop database foo; +drop database mysqltest; show status like "Qcache_queries_in_cache"; # |