Files
tidb/tests/integrationtest/t/table/cache.test

121 lines
4.4 KiB
Plaintext

# TestCacheTablePointGet
drop table if exists cache_point;
create table cache_point (id int primary key auto_increment, u int unique, v int);
insert into cache_point values(1, 11, 101);
insert into cache_point values(2, 12, 102);
alter table cache_point cache;
# check point get out transaction
select * from cache_point where id=1;
select * from cache_point where u=11;
select * from cache_point where id=2;
select * from cache_point where u=12;
select * from cache_point where u > 10 and u < 12;
# check point get in transaction
begin;
select * from cache_point where id=1;
select * from cache_point where u=11;
select * from cache_point where id=2;
select * from cache_point where u=12;
insert into cache_point values(3, 13, 103);
select * from cache_point where id=3;
select * from cache_point where u=13;
select * from cache_point where u > 12 and u < 14;
update cache_point set v=999 where id=2;
select * from cache_point where id=2;
commit;
# check point get after transaction
select * from cache_point where id=3;
select * from cache_point where u=13;
select * from cache_point where id=2;
alter table cache_point nocache;
drop table cache_point;
# TestCacheTableBatchPointGet
drop table if exists bp_cache_tmp1;
create table bp_cache_tmp1 (id int primary key auto_increment, u int unique, v int);
insert into bp_cache_tmp1 values(1, 11, 101);
insert into bp_cache_tmp1 values(2, 12, 102);
insert into bp_cache_tmp1 values(3, 13, 103);
insert into bp_cache_tmp1 values(4, 14, 104);
alter table bp_cache_tmp1 cache;
# check point get out transaction
select * from bp_cache_tmp1 where id in (1, 3);
select * from bp_cache_tmp1 where u in (11, 13);
select * from bp_cache_tmp1 where id in (1, 3, 5);
select * from bp_cache_tmp1 where u in (11, 13, 15);
select * from bp_cache_tmp1 where u in (11, 13) and u in (12, 13);
# check point get in transaction
begin;
select * from bp_cache_tmp1 where id in (1, 3);
select * from bp_cache_tmp1 where u in (11, 13);
select * from bp_cache_tmp1 where id in (1, 3, 5);
select * from bp_cache_tmp1 where u in (11, 13, 15);
insert into bp_cache_tmp1 values(6, 16, 106);
select * from bp_cache_tmp1 where id in (1, 6);
select * from bp_cache_tmp1 where u in (11, 16);
update bp_cache_tmp1 set v=999 where id=3;
select * from bp_cache_tmp1 where id in (1, 3);
select * from bp_cache_tmp1 where u in (11, 13);
select * from bp_cache_tmp1 where u in (11, 13) and u in (12, 13);
delete from bp_cache_tmp1 where id=4;
select * from bp_cache_tmp1 where id in (1, 4);
select * from bp_cache_tmp1 where u in (11, 14);
commit;
# check point get after transaction
select * from bp_cache_tmp1 where id in (1, 3, 6);
select * from bp_cache_tmp1 where u in (11, 13, 16);
select * from bp_cache_tmp1 where id in (1, 4);
select * from bp_cache_tmp1 where u in (11, 14);
alter table bp_cache_tmp1 nocache;
drop table bp_cache_tmp1;
# TestCacheTableAddColumns
drop table if exists cache_add_column;
create table cache_add_column (f1 int, index k(f1));
insert into cache_add_column (f1) values (1);
alter table cache_add_column add column f2 int not null, add column f3 int default 3, add column f4 int default null;
alter table cache_add_column cache;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
select sleep(0.1);
select * from cache_add_column use index(k) where f1 = 1;
alter table cache_add_column nocache;
drop table cache_add_column;