~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# Tests simple INSERT statements and the transaction log
#

# Ignore startup/shutdown events
--disable_query_log
--source ../plugin/transaction_log/tests/t/truncate_log.inc
--enable_query_log


# Populate log with some records...
##--source ../plugin/transaction_log/tests/t/insert.inc
#
# Simple test of the transaction log for single INSERT statements
#
# We create a table and insert some records
# into it.
#
# We then use the transaction_reader in plugin/transaction_log/utilities to read the events.
#

select seapitester_clear_engine_state_history();

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (
  pk int auto_increment primary key,
  id INT NOT NULL
, padding VARCHAR(200) NOT NULL
) engine=storage_engine_api_tester;
#enable error inject
SELECT seapitester_error_inject(1);

--error ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (id,padding) values (40, "boo"),(41,"scary");
begin;
INSERT INTO t1 (id,padding) VALUES (1, "I love testing.");
--error ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (id,padding) VALUES (2, "I hate testing.");
update t1 set padding="bar" where id=1;
commit;
INSERT INTO t1 (id,padding) VALUES (2, "I hate testing.");
--error ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (id,padding) VALUES (3, "I hate testing too.");
COMMIT;
select * from t1;
DROP TABLE t1;
# disable err inject
select seapitester_error_inject(0);
# Read in the transaction.log.

select * from data_dictionary.seapitester_engine_state_history;
select seapitester_clear_engine_state_history();

--replace_result $DRIZZLETEST_VARDIR VARDIR
--exec $DRIZZLE_TRX_READER $DRIZZLETEST_VARDIR/master-data/local/transaction.log

# Truncate the log file to reset for the next test
--source ../plugin/transaction_log/tests/t/truncate_log.inc

select * from data_dictionary.seapitester_engine_state_history;