1
# transaction_log_schema
2
# Test of CREATE / DROP /ALTER SCHEMA statements and how the transaction log
3
# captures / represents them
5
# Ignore startup/shutdown events
7
--source ../plugin/transaction_log/tests/t/truncate_log.inc
11
--echo Simple CREATE / DROP test
12
--echo Testing simple CREATE SCHEMA
13
CREATE SCHEMA my_test_schema;
14
--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
17
--echo Testing simple DROP SCHEMA
18
DROP SCHEMA my_test_schema;
19
--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
22
# Truncate the log file to reset for the next test
23
--source ../plugin/transaction_log/tests/t/truncate_log.inc
26
--echo Testing DROP SCHEMA on non-empty schema
27
CREATE SCHEMA my_test_schema;
28
CREATE TABLE my_test_schema.t1 (a int not null, primary key(a));
29
CREATE TABLE my_test_schema.t2 LIKE my_test_schema.t1;
30
CREATE TABLE my_test_schema.t3 LIKE my_test_schema.t2;
32
--echo We truncate the log to simplify test validation
33
--echo we are mainly concerned that we see 4 new entries
34
--echo once we have issued the DROP SCHEMA statement
35
--source ../plugin/transaction_log/tests/t/truncate_log.inc
39
DROP SCHEMA my_test_schema;
40
# We check to see that t1,t2,t3 are DROPped as well
41
--echo The implied DROP TABLE statements for t1->t3
42
--echo do not come in any deterministic order t1 may or may not be first
43
--echo ,therefore we have to satisfy ourselves that we have 4 items in the log
44
--echo after issuing the DROP SCHEMA
45
--echo We do check the first entry (OFFSET=0) as this should be the first of 3 DROP TABLE messages
47
--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/ /table_name: "t[1|2|3]"/table_name: TABLE_NAME/ /transaction_id: [0-9]+/TRANSACTION_ID/
48
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',0);
51
--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
54
# Truncate the log file to reset for the next test
55
--source ../plugin/transaction_log/tests/t/truncate_log.inc
58
--echo Testing simple CREATE SCHEMA
59
CREATE SCHEMA my_test_schema;
61
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b CHAR(50), PRIMARY KEY(a));
62
ALTER SCHEMA my_test_schema COLLATE utf8_turkish_ci;
64
--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
66
CREATE TABLE t2 LIKE t1;
67
--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
69
DROP SCHEMA my_test_schema;
71
# Truncate the log file to reset for the next test
72
--source ../plugin/transaction_log/tests/t/truncate_log.inc