--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc

call mtr.add_suppression("InnoDB: Cannot shrink the temporary tablespace");
--source include/restart_mysqld.inc
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2;
CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
                          f2 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_65536;
DROP TABLE t1;
SELECT NAME, FILE_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE SPACE= 4294967294;

SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG="+d,fail_temp_truncate";
SET GLOBAL INNODB_TRUNCATE_TEMPORARY_TABLESPACE_NOW= 1;
SELECT NAME, FILE_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE SPACE= 4294967294;
SET DEBUG_DBUG=@saved_debug_dbug;

SET GLOBAL INNODB_TRUNCATE_TEMPORARY_TABLESPACE_NOW= 1;
SELECT NAME, FILE_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE SPACE= 4294967294;
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=default;
