mariadb/mysql-test/t/key_cache.test
unknown 69cee79246 WorkLog #1323 (part 2)
New Statement: SHOW [STORAGE] ENGINES
New System Variable: storage_engine
New mysqld Argument: --default-storage-engine=


include/mysqld_error.h:
  We now call handlers STORAGE ENGINEs
include/sql_state.h:
  We now call handlers STORAGE ENGINEs
mysql-test/r/create.result:
  table_type system variable becomes storage_engine
mysql-test/r/key_cache.result:
  table_type system variable becomes storage_engine
mysql-test/r/variables.result:
  table_type system variable becomes storage_engine
mysql-test/r/warnings.result:
  Test for deprecated table_type system variable
mysql-test/t/create.test:
  table_type system variable becomes storage_engine
mysql-test/t/key_cache.test:
  table_type system variable becomes storage_engine
mysql-test/t/variables.test:
  table_type system variable becomes storage_engine
mysql-test/t/warnings.test:
  Test for deprecated table_type system variable
sql/handler.cc:
  change name for consistency
sql/handler.h:
  change name for consistency
sql/lex.h:
  New keywords - ENGINES and STORAGE
sql/mysql_priv.h:
  change name for consistency
sql/mysqld.cc:
  New command like argument for default-storage-engine
sql/set_var.cc:
  New system variable for storage_engine
sql/set_var.h:
  New system variable for storage_engine
sql/sql_lex.h:
  Change for consistancy
sql/sql_parse.cc:
  Change for consistancy
sql/sql_show.cc:
  Change for consistancy
sql/sql_table.cc:
  Change for consistancy
sql/sql_yacc.yy:
  New keywords: STORAGE and ENGINES
  Change table_types to storage_engines
  New statement: SHOW [STORAGE] ENGINES
2003-12-17 22:52:03 +00:00

142 lines
3.8 KiB
Text

#
# Test of multiple key caches
#
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
SET @save_key_buffer=@@key_buffer_size;
SELECT @@key_buffer_size, @@small.key_buffer_size;
# Change default key cache size
SET @@global.key_buffer_size=16*1024*1024;
SET @@global.default.key_buffer_size=16*1024*1024;
SET @@global.default.key_buffer_size=16*1024*1024;
SET @@global.small.key_buffer_size=1*1024*1024;
SET @@global.medium.key_buffer_size=4*1024*1024;
# Drop buffer
SET @@global.medium.key_buffer_size=0;
# Test double drop
SET @@global.medium.key_buffer_size=0;
# Print key buffer with different syntaxes
SHOW VARIABLES like "key_buffer_size";
SELECT @@key_buffer_size;
SELECT @@global.key_buffer_size;
SELECT @@global.default.key_buffer_size;
SELECT @@global.default.`key_buffer_size`;
SELECT @@global.`default`.`key_buffer_size`;
SELECT @@`default`.key_buffer_size;
SELECT @@small.key_buffer_size;
SELECT @@medium.key_buffer_size;
SET @@global.key_buffer_size=@save_key_buffer;
#
# Errors
#
--error 1064
SELECT @@default.key_buffer_size;
--error 1271
SELECT @@skr.storage_engine="test";
select @@keycache1.key_cache_block_size;
select @@keycache1.key_buffer_size;
set global keycache1.key_cache_block_size=2048;
select @@keycache1.key_buffer_size;
select @@keycache1.key_cache_block_size;
set global keycache1.key_buffer_size=1*1024*1024;
select @@keycache1.key_buffer_size;
select @@keycache1.key_cache_block_size;
set global keycache2.key_buffer_size=4*1024*1024;
select @@keycache2.key_buffer_size;
select @@keycache2.key_cache_block_size;
set global keycache1.key_buffer_size=0;
select @@keycache1.key_buffer_size;
select @@keycache1.key_cache_block_size;
select @@key_buffer_size;
select @@key_cache_block_size;
set global keycache1.key_buffer_size=1024*1024;
create table t1 (p int primary key, a char(10)) delay_key_write=1;
create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
(3, 1, 'yyyy'), (4, 3, 'zzzz');
select * from t1;
select * from t2;
update t1 set p=2 where p=1;
update t2 set i=2 where i=1;
cache index t1 keys (`primary`) in keycache1;
explain select p from t1;
select p from t1;
explain select i from t2;
select i from t2;
explain select count(*) from t1, t2 where t1.p = t2.i;
select count(*) from t1, t2 where t1.p = t2.i;
cache index t2 in keycache1;
update t2 set p=p+1000, i=2 where a='qqqq';
cache index t2 in keycache2;
insert into t2 values (2000, 3, 'yyyy');
cache index t2 in keycache1;
update t2 set p=3000 where a='zzzz';
select * from t2;
explain select p from t2;
select p from t2;
explain select i from t2;
select i from t2;
explain select a from t2;
select a from t2;
# Test some error conditions
--error 1283
cache index t1 in unknown_key_cache;
cache index t1 keys (unknown_key) in keycache1;
select @@keycache2.key_buffer_size;
select @@keycache2.key_cache_block_size;
set global keycache2.key_buffer_size=0;
select @@keycache2.key_buffer_size;
select @@keycache2.key_cache_block_size;
set global keycache2.key_buffer_size=1024*1024;
select @@keycache2.key_buffer_size;
update t2 set p=4000 where a='zzzz';
update t1 set p=p+1;
set global keycache1.key_buffer_size=0;
select * from t2;
select p from t2;
explain select i from t2;
select i from t2;
explain select a from t2;
select a from t2;
select * from t1;
select p from t1;
# Use the 'small' key cache
create table t3 (like t1);
cache index t3 in small;
insert into t3 select * from t1;
cache index t3 in keycache2;
cache index t1,t2 in default;
drop table t1,t2,t3;
# Cleanup
# We don't reset keycache2 as we want to ensure that mysqld will reset it
set global keycache2.key_buffer_size=0;
# Test to set up a too small size for a key cache (bug #2064)
set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0;