1if ! is_xtradb || ! is_server_version_higher_than 5.5.23 || ! is_server_version_lower_than 5.6.0
2then
3    skip_test "Requires PS 5.5.23 or higher, but less than 5.6"
4fi
5
6function long_transaction()
7{
8    mysql foo <<EOF
9start transaction;
10insert into sbtest values (999999999, 'longrunning transaction');
11select sleep(1000);
12EOF
13}
14
15start_server
16
17mysql <<EOF
18create database foo;
19CREATE TABLE foo.sbtest (
20  i int PRIMARY KEY,
21  c char(50) CHARACTER SET utf8 COLLATE utf8_general50_ci NOT NULL DEFAULT ''
22) ENGINE=InnoDB;
23EOF
24
25multi_row_insert foo.sbtest \({1..100},\'"text"\'\)
26record_db_state foo
27long_transaction &
28sleep 1
29
30xtrabackup --backup --target-dir=$topdir/backup
31xtrabackup --prepare --target-dir=$topdir/backup
32
33stop_server
34rm -rf $mysql_datadir
35xtrabackup --move-back --target-dir=$topdir/backup
36start_server
37
38verify_db_state foo
39