### test to check if performance_schema.events_waits_history_long
### reflects correct data

### disable for embedded server
--source include/not_embedded.inc
update  performance_schema.setup_instruments set enabled='YES' where name like '%innodb_temp%';
update performance_schema.setup_consumers set enabled='YES';
use test;
CREATE TABLE `t1`(`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name1` varchar(180) NOT NULL, `name2` varchar(180) DEFAULT NULL, `name3` varchar(180) DEFAULT NULL, `name4` varchar(180) DEFAULT NULL, PRIMARY KEY (`id`,`name1`(10)) ) engine=InnoDB;
 set @id:=0;

### populate random data
 insert into t1 values
  (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000))
, (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000))
, (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000))
, (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000));
insert into `t1`(`id`,`name1`,`name2`,`name3`,`name4`)
select  @id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000)  from
`t1` k1, `t1` k2, `t1` k3, `t1` k4,`t1` k5,`t1` k6;

#create inplace index and check if data is mention in events_waits_h
create index i_dtyp_big on `t1`(name1) algorithm=inplace;

--replace_regex /[\\\/]Innodb Merge Temp File/#Innodb Merge Temp File/
--replace_result $MYSQLTEST_VARDIR_ABS MYSQL_TEST_DIR

select distinct object_name from performance_schema.events_waits_history_long where event_name like '%wait%io%file%innodb%innodb_temp_file%'
and object_name like '%Innodb Merge Temp File%';
drop table t1;

