--source include/have_falcon.inc

#
# Bug #28048: High probability of crash when executing transactional tests several times
#   This test is derived from innodb.test
#
--echo *** Bug #28048 ***

# ----------------------------------------------------- #
# --- Initialisation                                --- #
# ----------------------------------------------------- #
let $engine = 'Falcon';
eval SET @@storage_engine = $engine;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

# ----------------------------------------------------- #
# --- Test                                          --- #
# ----------------------------------------------------- #
# We need several attempts to reach the problem.
let $num= 1000;
while ($num)
{
create table t1 (n int not null primary key);
set @@autocommit = 0;
insert into t1 values (4);
rollback;
select n, "after rollback" from t1;
insert into t1 values (4);
commit;
select n, "after commit" from t1;
commit;
insert into t1 values (5);
--error ER_DUP_ENTRY
insert into t1 values (4);
commit;
select n, "after commit" from t1;
set @@autocommit = 1;
insert into t1 values (6);
--error ER_DUP_ENTRY
insert into t1 values (4);
select n from t1;
set @@autocommit = 0;

DROP TABLE t1;
dec $num;
--echo $num;
}

# ----------------------------------------------------- #
# --- Check                                         --- #
# ----------------------------------------------------- #
# Final check is not applicable in this test.
#SELECT count(*) FROM t1;

# ----------------------------------------------------- #
# --- Final cleanup                                 --- #
# ----------------------------------------------------- #
SET @@autocommit = DEFAULT;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
