--
-- Script attempting to reproduce BUG#4285 (unsucessfully).
--
-- Notice that, to get the status of the key cache, one must run
--   'mysqladmin debug'
-- in a separate console. This will print the status on the console where the
-- server was started.


drop table if exists t1;
drop table if exists t2;

create table t1 (
  c1 int auto_increment primary key, c2 int not null, c3 int not null
) engine = MyISAM;

create table t2 (
  c1 int auto_increment primary key, c2 int not null, c3 int not null
) engine = MyISAM;

insert into t1 (c2, c3) values (311,711), (312, 712), (313, 713), (314, 714);
insert into t2 select * from t1;

create index i1t1 on t1 (c1, c2);
create index i2t1 on t1 (c2, c3);

create index i1t2 on t2 (c1, c2);
create index i2t2 on t2 (c2, c3);

-- How to repeat:

-- 1) Create a new key cache,
set global kc_t2.key_buffer_size=8388572; -- same as default size

-- 2) assign specific tables to the new key cache, and
cache index t2 in kc_t2;

-- 3) preload some tables in the default key cache.

load index into cache t1;

-- Test queries
select * from t2 where t2.c1 = 3; -- after this query kc_t2 is be used
select * from t1 where t1.c1 = 3; -- after this query the default cache is used
select * from t1, t2 where t1.c1 = t2.c1; -- make use of both caches
