~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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# Tests simple INSERT statements and the transaction log
#

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

--disable_warnings
DROP TABLE IF EXISTS t1;

--enable_warnings

CREATE TABLE src (
  pk int auto_increment primary key,
  d varchar(16000)
);

CREATE TABLE dst (
  pk int primary key,
  d varchar(16000) NOT NULL
);

insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (repeat("B",16000));
insert into src (d) values (NULL);

--source ../plugin/transaction_log/tests/t/truncate_log.inc
--enable_query_log

START TRANSACTION;
--error ER_BAD_NULL_ERROR
INSERT into dst SELECT * from src ORDER BY pk ASC;
COMMIT;

--echo
--replace_regex /start_timestamp: [0-9]+/START_TIMESTAMP/g /end_timestamp: [0-9]+/END_TIMESTAMP/g /creation_timestamp: [0-9]+/CREATE_TIMESTAMP/ /update_timestamp: [0-9]+/UPDATE_TIMESTAMP/ /transaction_id: [0-9]+/TRANSACTION_ID/
--exec ../plugin/transaction_log/utilities/transaction_reader --raw var/master-data/local/transaction.log

--echo
--exec ../plugin/transaction_log/utilities/transaction_reader var/master-data/local/transaction.log

--disable_query_log
DROP TABLE src;
DROP TABLE dst;

CREATE TABLE src (pk int auto_increment primary key, d varchar(5));
CREATE TABLE dst (pk int auto_increment primary key, d varchar(5) not null);

--source ../plugin/transaction_log/tests/t/truncate_log.inc

--enable_query_log

--echo
START TRANSACTION;
INSERT INTO src (d) VALUES ('aaa'), ('bbb'), (NULL);
--error ER_BAD_NULL_ERROR
INSERT INTO dst (d) SELECT d FROM src ORDER BY pk;
INSERT INTO dst (d) VALUES ('xyz');
COMMIT;

--echo
SELECT * FROM src;
--echo
SELECT * FROM dst;

--echo
--source ../plugin/transaction_log/tests/t/check_transaction_log.inc

# Truncate the log file to reset for the next test
--disable_query_log
DROP TABLE src;
DROP TABLE dst;
--source ../plugin/transaction_log/tests/t/truncate_log.inc
--enable_query_log