2 # Specify storage engine to use. Variable $engine is set in wrapper test.
4 eval SET @@storage_engine = $engine;
5 if (`SELECT @@storage_engine LIKE 'InnoDB' AND @@version LIKE '%6.%'`)
7 # Need this due to Bug#43447 - Crash when executing SELECT ... LIMIT n FOR UPDATE query
8 # Hopefully temporary...
9 # Not applicable to 5.1 server or earlier.
11 SET GLOBAL optimizer_use_mrr='disable';
12 SET GLOBAL engine_condition_pushdown=off;
16 if (`SELECT @@storage_engine LIKE 'PBXT' AND @@version LIKE '%5.1%'`)
19 SET SESSION binlog_format = 'MIXED';
20 SET GLOBAL binlog_format = 'MIXED';
24 # Verify default storage engine.
25 SHOW VARIABLES LIKE 'storage_engine';
27 # Verify default isolation level
28 SHOW VARIABLES LIKE 'tx_isolation';
31 # Create table for keeping track of test metadata/statistics (counters etc.).
32 # (Need a data structure that will hold across tests, clients, sessions).
33 # Expand/modify if needeed, but take care of test files using it.
36 # deadlocks - keeps track of the total number of deadlocks so far.
38 # Using default storage engine (see above).
39 CREATE TABLE statistics (
40 tx_errors INTEGER NOT NULL
43 # Initialize statistics table.
44 INSERT INTO statistics (tx_errors) VALUES (0);
47 # Create main test / data table. Some notes:
48 # * timestamp is automatically DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
49 # * BOOLEAN is TINYINT(1)
50 # * `is_consistent` means that the sum of int1* and int2* columns in that row
51 # is = 0. NOTE: Do not change meaning unless you take care to
52 # change test cases that rely on it (e.g. rr_id_900).
53 # Set `is_consistent` = 0 if changing a row's sum to non-zero.
55 # TODO: Get TID (thread_id) from mysql-stress-test.pl somehow.
59 `pk` INTEGER AUTO_INCREMENT NOT NULL,
60 `id` INTEGER NOT NULL,
63 `int1_unique` INTEGER,
66 `int2_unique` INTEGER,
67 `for_update` BOOLEAN DEFAULT 0,
68 `timestamp` TIMESTAMP,
69 `connection_id` INTEGER,
70 `thread_id` INTEGER DEFAULT 0,
71 `is_uncommitted` BOOLEAN DEFAULT 0,
72 `is_consistent` BOOLEAN DEFAULT 0,
76 UNIQUE (`int1_unique`),
77 UNIQUE (`int2_unique`),
81 # Check that the table was really created with the intended storage engine.
84 ## Procedure for inserting the value 1000 into integer fieds, "rows" times.
88 eval CREATE PROCEDURE insertRows(rows INT)
92 INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
93 `int2`, `int2_key`, `int2_unique`,
94 `for_update`, `connection_id`, `thread_id`,
95 `is_uncommitted`, `is_consistent`)
96 VALUES (0, 1000, 1000, @n,
98 0, CONNECTION_ID(), 0,
109 CALL insertRows(1000);
111 ## Check the sum of all int columns
112 SELECT SUM(`int1` + `int1_key` + `int1_unique`
113 + `int2` + `int2_key` + `int2_unique`)