--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc

--echo #
--echo # Bug#23477214 RACE CONDITION BETWEEN FIL_IBD_CREATE()
--echo # AND SELECT * FROM I_S.FILES
--echo #
--connect (con1,localhost,root,,)
SET DEBUG_SYNC='fil_ibd_created_space SIGNAL halfway WAIT_FOR done';
--send CREATE TABLESPACE t ADD DATAFILE 't.ibd'
--connection default

SET DEBUG_SYNC='now WAIT_FOR halfway';
SELECT file_type FROM INFORMATION_SCHEMA.FILES WHERE tablespace_name='t';
SET DEBUG_SYNC='now SIGNAL done';

--connection con1
--reap
--disconnect con1

--connection default
SELECT file_type FROM INFORMATION_SCHEMA.FILES WHERE tablespace_name='t';
DROP TABLESPACE t;

--source include/wait_until_count_sessions.inc
