mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Test suites for engine testing, moved from test-extra so will be available
for general use. mysql-test/Makefile.am: Adding directories of additional test suites mysql-test/mysql-stress-test.pl: Adding check for additional errors checking during test run
This commit is contained in:
81
mysql-test/suite/engines/rr_trx/r/init_innodb.result
Normal file
81
mysql-test/suite/engines/rr_trx/r/init_innodb.result
Normal file
@@ -0,0 +1,81 @@
|
||||
SET @@storage_engine = 'InnoDB';
|
||||
SHOW VARIABLES LIKE 'storage_engine';
|
||||
Variable_name Value
|
||||
storage_engine InnoDB
|
||||
SHOW VARIABLES LIKE 'tx_isolation';
|
||||
Variable_name Value
|
||||
tx_isolation REPEATABLE-READ
|
||||
CREATE TABLE statistics (
|
||||
tx_errors INTEGER NOT NULL
|
||||
);
|
||||
INSERT INTO statistics (tx_errors) VALUES (0);
|
||||
CREATE TABLE t1 (
|
||||
`pk` INTEGER AUTO_INCREMENT NOT NULL,
|
||||
`id` INTEGER NOT NULL,
|
||||
`int1` INTEGER,
|
||||
`int1_key` INTEGER,
|
||||
`int1_unique` INTEGER,
|
||||
`int2` INTEGER,
|
||||
`int2_key` INTEGER,
|
||||
`int2_unique` INTEGER,
|
||||
`for_update` BOOLEAN DEFAULT 0,
|
||||
`timestamp` TIMESTAMP,
|
||||
`connection_id` INTEGER,
|
||||
`thread_id` INTEGER DEFAULT 0,
|
||||
`is_uncommitted` BOOLEAN DEFAULT 0,
|
||||
`is_consistent` BOOLEAN DEFAULT 0,
|
||||
KEY (`id`),
|
||||
KEY (`int1_key`),
|
||||
KEY (`int2_key`),
|
||||
UNIQUE (`int1_unique`),
|
||||
UNIQUE (`int2_unique`),
|
||||
PRIMARY KEY (`pk`)
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(11) NOT NULL,
|
||||
`int1` int(11) DEFAULT NULL,
|
||||
`int1_key` int(11) DEFAULT NULL,
|
||||
`int1_unique` int(11) DEFAULT NULL,
|
||||
`int2` int(11) DEFAULT NULL,
|
||||
`int2_key` int(11) DEFAULT NULL,
|
||||
`int2_unique` int(11) DEFAULT NULL,
|
||||
`for_update` tinyint(1) DEFAULT '0',
|
||||
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`connection_id` int(11) DEFAULT NULL,
|
||||
`thread_id` int(11) DEFAULT '0',
|
||||
`is_uncommitted` tinyint(1) DEFAULT '0',
|
||||
`is_consistent` tinyint(1) DEFAULT '0',
|
||||
PRIMARY KEY (`pk`),
|
||||
UNIQUE KEY `int1_unique` (`int1_unique`),
|
||||
UNIQUE KEY `int2_unique` (`int2_unique`),
|
||||
KEY `id` (`id`),
|
||||
KEY `int1_key` (`int1_key`),
|
||||
KEY `int2_key` (`int2_key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
CREATE PROCEDURE insertRows(rows INT)
|
||||
BEGIN
|
||||
SET @n = 1;
|
||||
REPEAT
|
||||
INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `connection_id`, `thread_id`,
|
||||
`is_uncommitted`, `is_consistent`)
|
||||
VALUES (0, 1000, 1000, @n,
|
||||
-1000, -1000, -@n,
|
||||
0, CONNECTION_ID(), 0,
|
||||
0, 1);
|
||||
SET @n = @n + 1;
|
||||
UNTIL @n > rows
|
||||
END REPEAT;
|
||||
END;
|
||||
//
|
||||
CALL insertRows(1000);
|
||||
SELECT SUM(`int1` + `int1_key` + `int1_unique`
|
||||
+ `int2` + `int2_key` + `int2_unique`)
|
||||
AS TotalSum
|
||||
FROM t1;
|
||||
TotalSum
|
||||
0
|
10
mysql-test/suite/engines/rr_trx/r/rr_c_count_not_zero.result
Normal file
10
mysql-test/suite/engines/rr_trx/r/rr_c_count_not_zero.result
Normal file
@@ -0,0 +1,10 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
*** Running query: SELECT COUNT(*) FROM t1
|
||||
SELECT COUNT(*) FROM t1 WHERE `pk` MOD 5 = 0 AND `pk` BETWEEN 1 AND 1000;
|
||||
COUNT(*)
|
||||
200
|
||||
SELECT COUNT(*) FROM t1 WHERE `pk` MOD 5 = 0 AND `pk` BETWEEN 1 AND 1000;
|
||||
COUNT(*)
|
||||
200
|
||||
COMMIT;
|
3
mysql-test/suite/engines/rr_trx/r/rr_c_stats.result
Normal file
3
mysql-test/suite/engines/rr_trx/r/rr_c_stats.result
Normal file
@@ -0,0 +1,3 @@
|
||||
SELECT * FROM statistics;
|
||||
tx_errors
|
||||
0
|
58
mysql-test/suite/engines/rr_trx/r/rr_i_40-44.result
Normal file
58
mysql-test/suite/engines/rr_trx/r/rr_i_40-44.result
Normal file
@@ -0,0 +1,58 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
|
||||
*** multi-statemement insert, inserting first positive then negative number:
|
||||
|
||||
INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `connection_id`, `thread_id`, `is_uncommitted`, `is_consistent`)
|
||||
VALUES (40, 40, 40, CONNECTION_ID(),
|
||||
-40, -40, -CONNECTION_ID(),
|
||||
0, CONNECTION_ID(), 0, 0, 1);
|
||||
INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `connection_id`, `thread_id`, `is_uncommitted`, `is_consistent`)
|
||||
VALUES (-40, -40, -40, -CONNECTION_ID(),
|
||||
40, 40, CONNECTION_ID(),
|
||||
0, CONNECTION_ID(), 0, 0, 1);
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
|
||||
*** insert multiple rows using a single statement:
|
||||
|
||||
INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `connection_id`, `thread_id`, `is_uncommitted`, `is_consistent`)
|
||||
VALUES (41, 41, 41, CONNECTION_ID()+1,
|
||||
-41, -41, -(CONNECTION_ID()+1),
|
||||
0, CONNECTION_ID(), 0, 0, 1),
|
||||
(41, 41, 41, CONNECTION_ID()+2,
|
||||
41, 41, CONNECTION_ID()+2,
|
||||
0, CONNECTION_ID(), 0, 0, 0),
|
||||
(41, -41, -41, -(CONNECTION_ID()+2),
|
||||
-41, -41, -(CONNECTION_ID()+2),
|
||||
0, CONNECTION_ID(), 0, 0, 0);
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
|
||||
*** INSERT IGNORE using both known duplicate values and non-duplicates:
|
||||
|
||||
INSERT IGNORE INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `connection_id`, `thread_id`, `is_uncommitted`, `is_consistent`)
|
||||
VALUES (42, 42, 42, CONNECTION_ID()+3,
|
||||
-42, -42, -(CONNECTION_ID()+3),
|
||||
0, CONNECTION_ID(), 0, 0, 1);
|
||||
INSERT IGNORE INTO t1 (`pk`, `id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `connection_id`, `thread_id`, `is_uncommitted`, `is_consistent`)
|
||||
VALUES (5, 43, 42, 42, CONNECTION_ID(),
|
||||
-42, -42, CONNECTION_ID(),
|
||||
0, CONNECTION_ID(), 0, 0, 0);
|
||||
INSERT IGNORE INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `connection_id`, `thread_id`, `is_uncommitted`, `is_consistent`)
|
||||
VALUES (44, 42, 42, (CONNECTION_ID() + 1000) MOD 5000,
|
||||
-42, -42, -((CONNECTION_ID() + 1000) MOD 5000),
|
||||
0, CONNECTION_ID(), 0, 0, 1);
|
||||
COMMIT;
|
5
mysql-test/suite/engines/rr_trx/r/rr_id_3.result
Normal file
5
mysql-test/suite/engines/rr_trx/r/rr_id_3.result
Normal file
@@ -0,0 +1,5 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (`id`, `int1`, `connection_id`, `is_uncommitted`)
|
||||
VALUES (3, 3, CONNECTION_ID(), 1);
|
||||
COMMIT;
|
33
mysql-test/suite/engines/rr_trx/r/rr_id_900.result
Normal file
33
mysql-test/suite/engines/rr_trx/r/rr_id_900.result
Normal file
@@ -0,0 +1,33 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
|
||||
*** Delete a row and re-insert with same `pk`:
|
||||
|
||||
*** Disabling result log
|
||||
SELECT @pk:=`pk`,
|
||||
@unique1:=`int1_unique`,
|
||||
@unique2:=`int2_unique`
|
||||
FROM t1 WHERE `pk` MOD 5 = 4 AND `pk` > 900 AND `is_consistent` = 1 LIMIT 1 FOR UPDATE;
|
||||
*** Enabling result log
|
||||
DELETE FROM t1 WHERE `pk` = @pk;
|
||||
*** Doing insert of row with pk = @pk if above statement succeeded (query log disabled)...
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
|
||||
*** Delete a row and re-insert with `pk` = NULL:
|
||||
|
||||
*** Disabling result log
|
||||
SELECT @pk:=`pk`,
|
||||
@unique1:=`int1_unique`,
|
||||
@unique2:=`int2_unique`
|
||||
FROM t1 WHERE `pk` MOD 5 = 4 AND `pk` > 901 AND `is_consistent` = 1 LIMIT 1 FOR UPDATE;
|
||||
*** Enabling result log
|
||||
DELETE FROM t1 WHERE `pk` = @pk;
|
||||
*** Doing insert of row with pk = NULL if above statement succeeded (query log disabled)...
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
|
||||
*** Delete up to two (2) "consistent" rows (zero-sum; table sum unchanged)
|
||||
|
||||
DELETE FROM t1 WHERE `pk` > 902 AND `pk` MOD 5 = 3 AND `is_consistent` = 1 LIMIT 2;
|
||||
COMMIT;
|
13
mysql-test/suite/engines/rr_trx/r/rr_insert_select_2.result
Normal file
13
mysql-test/suite/engines/rr_trx/r/rr_insert_select_2.result
Normal file
@@ -0,0 +1,13 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`,
|
||||
`int2`, `int2_key`, `int2_unique`,
|
||||
`for_update`, `is_uncommitted`, `is_consistent`)
|
||||
SELECT src.`id`, src.`int1`, src.`int1_key`, src.`int1_unique`,
|
||||
src.`int2`, src.`int2_key`, src.`int2_unique`,
|
||||
src.`for_update`, src.`is_uncommitted`, src.`is_consistent`
|
||||
FROM t1 AS src
|
||||
WHERE (src.`pk` BETWEEN 1000 AND 1049) AND (src.`id` > 0) AND (src.`is_consistent` = 1) AND (src.`int1_unique` MOD 8 = 0)
|
||||
ON DUPLICATE KEY UPDATE `int1_unique`= src.`int1_unique` + CONNECTION_ID() + 1000, `int2_unique`= src.`int2_unique` - (CONNECTION_ID()+1000);
|
||||
*** Updating id and connection_id if we actually inserted something (query log disabled)...
|
||||
COMMIT;
|
@@ -0,0 +1,13 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
*** All changes done in this test / transaction will be rolled back.
|
||||
*** Disabling query log.
|
||||
*** Executing UPDATE on rows 501 -- 549 with id = 50, single statement.
|
||||
*** Executing UPDATE on rows 526 -- 549 with id = 50, single statement.
|
||||
*** Executing UPDATE on rows 501 -- 525 with id = 50, multiple statements.
|
||||
*** ROLLBACK
|
||||
*** START TRANSACTION
|
||||
*** Executing INSERTs of rows with id = 50, 2 statements.
|
||||
*** Executing DELETE of rows with pk between 449 and 540, single statement.
|
||||
*** Enabling query log.
|
||||
ROLLBACK;
|
34
mysql-test/suite/engines/rr_trx/r/rr_replace_7-8.result
Normal file
34
mysql-test/suite/engines/rr_trx/r/rr_replace_7-8.result
Normal file
@@ -0,0 +1,34 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
*** Disabling result log
|
||||
SELECT @pk:=`pk`, @unique:=`int1_unique`
|
||||
FROM t1
|
||||
WHERE `pk` MOD 5 <> 0
|
||||
AND `pk` > 200 + (CONNECTION_ID() MOD 1000)
|
||||
AND `int1_unique` NOT IN (SELECT `int1_unique` FROM t1 WHERE (`pk` < 1000 AND `pk` MOD 5 = 0) OR `is_consistent` = 0)
|
||||
AND -`int1_unique` NOT IN (SELECT `int2_unique` FROM t1 WHERE (`pk` < 1000 AND `pk` MOD 5 = 0) OR `is_consistent` = 0)
|
||||
AND `is_consistent`= 1
|
||||
LIMIT 1 FOR UPDATE;
|
||||
*** Enabling result log
|
||||
REPLACE INTO t1 SET `pk` = @pk,
|
||||
`id` = 7,
|
||||
`int1` = 7,
|
||||
`int1_key` = -7,
|
||||
`int1_unique` = @unique,
|
||||
`int2` = -7,
|
||||
`int2_key` = 7,
|
||||
`int2_unique` = -@unique,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = 1;
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
REPLACE INTO t1
|
||||
SELECT * FROM t1
|
||||
WHERE `pk` > 1000 + CONNECTION_ID() MOD 777
|
||||
AND `int1_unique` NOT IN (SELECT `int1_unique` FROM t1 WHERE `pk` < 1000 OR `is_consistent` = 0)
|
||||
AND `int2_unique` NOT IN (SELECT `int2_unique` FROM t1 WHERE `pk` < 1000 OR `is_consistent` = 0)
|
||||
AND `pk` MOD 5 <> 0
|
||||
AND `is_consistent` = 1
|
||||
ORDER BY `pk` LIMIT 1;
|
||||
*** Updating replaced row (if applicable)
|
||||
COMMIT;
|
@@ -0,0 +1,5 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
SELECT * FROM t1 WHERE `is_uncommitted` > 0;
|
||||
pk id int1 int1_key int1_unique int2 int2_key int2_unique for_update timestamp connection_id thread_id is_uncommitted is_consistent
|
||||
COMMIT;
|
@@ -0,0 +1,72 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
Comparing results from 2 queries (unless we deadlock or some such)...
|
||||
*** Query 1: SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key`
|
||||
*** Disabling query log (we may deadlock and not do this after all)
|
||||
*** Creating temp table with results from query 'SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key`' unless we deadlock or time out.
|
||||
*** Enabling query log
|
||||
*** Filler:
|
||||
SELECT SLEEP(1);
|
||||
SLEEP(1)
|
||||
0
|
||||
*** Query 2: SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key` LIMIT 987654321
|
||||
*** Disabling query log (we may deadlock and not do this after all)
|
||||
*** Creating temp table with results from query 'SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key` LIMIT 987654321' unless we deadlock or time out.
|
||||
*** Enabling query log
|
||||
*** Filler: Do something other than sleep while waiting for other transactions to do stuff...
|
||||
CREATE TEMPORARY TABLE tmpSelectLimitNoLimit (a INT, b VARCHAR(255), c TIMESTAMP, KEY(a));
|
||||
INSERT INTO tmpSelectLimitNoLimit VALUES
|
||||
(-1, 'This is a filler', NOW()),
|
||||
(0, 'More stuff', NOW()),
|
||||
(999999999, 'Even more bogus data', NOW()),
|
||||
(-98765, 'Even more bogus data', NOW());
|
||||
SELECT * FROM tmpSelectLimitNoLimit WHERE a < -99999999 ORDER BY a;
|
||||
a b c
|
||||
*** Query 3: SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key` LIMIT 987654321
|
||||
*** Disabling query log (we may deadlock and not do this after all)
|
||||
*** Creating temp table with results from query 'SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key` LIMIT 987654321' unless we deadlock or time out.
|
||||
*** Enabling query log
|
||||
*** Filler:
|
||||
UPDATE tmpSelectLimitNoLimit SET a = 3;
|
||||
SELECT SLEEP(1);
|
||||
SLEEP(1)
|
||||
0
|
||||
*** Query 4: SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key`
|
||||
*** Disabling query log (we may deadlock and not do this after all)
|
||||
*** Creating temp table with results from query 'SELECT * FROM t1 WHERE `pk` > 1000 ORDER BY `int1_key`' unless we deadlock or time out.
|
||||
*** Enabling query log
|
||||
***************************************************************************
|
||||
* Checking REPEATABLE READ by comparing result sets from same transaction
|
||||
***************************************************************************
|
||||
*** Query log disabled. See include files used by test for query details.
|
||||
*** Comparing query 1 (A) with query 2 (B):
|
||||
###########################
|
||||
# Detect missing rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
|
||||
###########################
|
||||
# Detect changed rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
*** Comparing query 2 (A) with query 3 (B):
|
||||
###########################
|
||||
# Detect missing rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
|
||||
###########################
|
||||
# Detect changed rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
*** Comparing query 3 (A) with query 4 (B):
|
||||
###########################
|
||||
# Detect missing rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
|
||||
###########################
|
||||
# Detect changed rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
COMMIT;
|
26
mysql-test/suite/engines/rr_trx/r/rr_sc_select-same_2.result
Normal file
26
mysql-test/suite/engines/rr_trx/r/rr_sc_select-same_2.result
Normal file
@@ -0,0 +1,26 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
*** Disabling query log (we may deadlock and not do this after all)
|
||||
*** Creating temp table with results from query 'SELECT * from t1' unless we deadlock or time out.
|
||||
*** Enabling query log
|
||||
SELECT SLEEP(1);
|
||||
SLEEP(1)
|
||||
0
|
||||
*** Disabling query log (we may deadlock and not do this after all)
|
||||
*** Creating temp table with results from query 'SELECT * from t1' unless we deadlock or time out.
|
||||
*** Enabling query log
|
||||
***************************************************************************
|
||||
* Checking REPEATABLE READ by comparing result sets from same transaction
|
||||
***************************************************************************
|
||||
*** Query log disabled. See include files used by test for query details.
|
||||
*** Comparing query 1 (A) with query 2 (B):
|
||||
###########################
|
||||
# Detect missing rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
|
||||
###########################
|
||||
# Detect changed rows:
|
||||
###########################
|
||||
A.pk B.pk A.id B.id A.int1 B.int1 A.int1_key B.int1_key A.int1_unique B.int1_unique A.int2 B.int2 A.int2_key B.int2_key A.int2_unique B.int2_unique A.for_update B.for_update A.timestamp B.timestamp A.connection_id B.connection_id A.thread_id B.thread_id A.is_uncommitted B.is_uncommitted A.is_consistent B.is_consistent
|
||||
COMMIT;
|
6
mysql-test/suite/engines/rr_trx/r/rr_sc_sum_total.result
Normal file
6
mysql-test/suite/engines/rr_trx/r/rr_sc_sum_total.result
Normal file
@@ -0,0 +1,6 @@
|
||||
SELECT @sum:=SUM(`int1` + `int1_key` + `int1_unique`
|
||||
+ `int2` + `int2_key` + `int2_unique`)
|
||||
AS TotalSum
|
||||
FROM t1;
|
||||
TotalSum
|
||||
0
|
153
mysql-test/suite/engines/rr_trx/r/rr_u_10-19.result
Normal file
153
mysql-test/suite/engines/rr_trx/r/rr_u_10-19.result
Normal file
@@ -0,0 +1,153 @@
|
||||
SET autocommit = 0;
|
||||
|
||||
*** Move record out of locked portion of index:
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` LIMIT 10 FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = `int1_key` + 50,
|
||||
`int2_key` = `int2_key` - 50,
|
||||
`id` = 10,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record out of locked portion of UNIQUE index:
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_unique` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_unique` LIMIT 10 FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_unique` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_unique` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_unique` = `int1_unique` + 50 + CONNECTION_ID(),
|
||||
`int2_unique` = `int2_unique` - 50 - CONNECTION_ID(),
|
||||
`id` = 11,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record into locked portion of index:
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` LIMIT 10 FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_key` > 1030 ORDER BY `int1_key`, `pk` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = `int1_key` + 50,
|
||||
`int2_key` = `int2_key` - 50,
|
||||
`id` = 12,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record inside locked portion of index (move it but stay inside the locked range):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` LIMIT 10 FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_key` BETWEEN 981 + 10 + (CONNECTION_ID() MOD 15) AND 1019 ORDER BY `int1_key`, `pk` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = `int1_key` - 10,
|
||||
`int2_key` = `int2_key` + 10,
|
||||
`id` = 13,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing index boundary (max):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @max:=MAX(`int2_key`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int2_key`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int2_key` = @max + 1,
|
||||
`int2` = `int2` - (@max + 1 - @old),
|
||||
`id` = 14,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing UNIQUE index boundary (max):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @max:=MAX(`int2_unique`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int2_unique`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int2_unique` = @max + 1,
|
||||
`int2` = `int2` - (@max + 1 - @old),
|
||||
`id` = 15,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing index boundary (min):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @min:=MIN(`int1_key`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int1_key`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = @min - 1,
|
||||
`int1` = `int1` - (@min - 1 - @old),
|
||||
`id` = 16,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing UNIQUE index boundary (min):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @min:=MIN(`int1_unique`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int1_unique`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_unique` = @min - 1,
|
||||
`int1` = `int1` - (@min - 1 - @old),
|
||||
`id` = 17,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record forward in index (add some number):
|
||||
|
||||
START TRANSACTION;
|
||||
UPDATE t1 SET `int2_key` = `int2_key` + 16,
|
||||
`int2` = `int2` - 16,
|
||||
`id` = 18,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = CONNECTION_ID() MOD 1000;
|
||||
|
||||
*** Move record backward in index (subtract some number):
|
||||
|
||||
UPDATE t1 SET `int1_key` = `int1_key` - 16,
|
||||
`int1` = `int1` + 16,
|
||||
`id` = 18,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = CONNECTION_ID() + 16 MOD 1000;
|
||||
COMMIT;
|
153
mysql-test/suite/engines/rr_trx/r/rr_u_10-19_nolimit.result
Normal file
153
mysql-test/suite/engines/rr_trx/r/rr_u_10-19_nolimit.result
Normal file
@@ -0,0 +1,153 @@
|
||||
SET autocommit = 0;
|
||||
|
||||
*** Move record out of locked portion of index:
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = `int1_key` + 50,
|
||||
`int2_key` = `int2_key` - 50,
|
||||
`id` = 10,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record out of locked portion of UNIQUE index:
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_unique` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_unique` FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_unique` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_unique` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_unique` = `int1_unique` + 50 + CONNECTION_ID(),
|
||||
`int2_unique` = `int2_unique` - 50 - CONNECTION_ID(),
|
||||
`id` = 11,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record into locked portion of index:
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_key` > 1030 ORDER BY `int1_key`, `pk` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = `int1_key` + 50,
|
||||
`int2_key` = `int2_key` - 50,
|
||||
`id` = 12,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record inside locked portion of index (move it but stay inside the locked range):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (result will vary)
|
||||
SELECT * FROM t1 WHERE `int1_key` BETWEEN 981 + (CONNECTION_ID() MOD 15) AND 1030 ORDER BY `int1_key`, `pk` FOR UPDATE;
|
||||
SELECT @pk:=`pk` FROM t1 WHERE `int1_key` BETWEEN 981 + 10 + (CONNECTION_ID() MOD 15) AND 1019 ORDER BY `int1_key`, `pk` LIMIT 1;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = `int1_key` - 10,
|
||||
`int2_key` = `int2_key` + 10,
|
||||
`id` = 13,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique` = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing index boundary (max):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @max:=MAX(`int2_key`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int2_key`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int2_key` = @max + 1,
|
||||
`int2` = `int2` - (@max + 1 - @old),
|
||||
`id` = 14,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing UNIQUE index boundary (max):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @max:=MAX(`int2_unique`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int2_unique`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int2_unique` = @max + 1,
|
||||
`int2` = `int2` - (@max + 1 - @old),
|
||||
`id` = 15,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing index boundary (min):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @min:=MIN(`int1_key`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int1_key`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_key` = @min - 1,
|
||||
`int1` = `int1` - (@min - 1 - @old),
|
||||
`id` = 16,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record outside existing UNIQUE index boundary (min):
|
||||
|
||||
START TRANSACTION;
|
||||
*** Disabling result log (results will vary)
|
||||
SELECT @min:=MIN(`int1_unique`), @pk:=FLOOR(1 + RAND() * (MAX(`pk`) - 1)) FROM t1;
|
||||
SELECT * FROM t1 WHERE `pk` = @pk FOR UPDATE;
|
||||
SELECT @old:=`int1_unique`, (@sum:=`int1` + `int2` + `int1_key` + `int2_key` + `int1_unique` + `int2_unique`) FROM t1 WHERE `pk` = @pk;
|
||||
*** Enabling result log
|
||||
UPDATE t1 SET `int1_unique` = @min - 1,
|
||||
`int1` = `int1` - (@min - 1 - @old),
|
||||
`id` = 17,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`is_consistent` = IF(@sum = 0, 1, 0),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = @pk;
|
||||
COMMIT;
|
||||
|
||||
*** Move record forward in index (add some number):
|
||||
|
||||
START TRANSACTION;
|
||||
UPDATE t1 SET `int2_key` = `int2_key` + 16,
|
||||
`int2` = `int2` - 16,
|
||||
`id` = 18,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = CONNECTION_ID() MOD 1000;
|
||||
|
||||
*** Move record backward in index (subtract some number):
|
||||
|
||||
UPDATE t1 SET `int1_key` = `int1_key` - 16,
|
||||
`int1` = `int1` + 16,
|
||||
`id` = 18,
|
||||
`connection_id` = CONNECTION_ID(),
|
||||
`thread_id` = 0
|
||||
WHERE `pk` = CONNECTION_ID() + 16 MOD 1000;
|
||||
COMMIT;
|
11
mysql-test/suite/engines/rr_trx/r/rr_u_4.result
Normal file
11
mysql-test/suite/engines/rr_trx/r/rr_u_4.result
Normal file
@@ -0,0 +1,11 @@
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
SET @conn_id = CONNECTION_ID(), @thread_id = 0;
|
||||
UPDATE t1 SET `int1` = `int1` - 4,
|
||||
`id` = 4,
|
||||
`is_consistent` = 0,
|
||||
`connection_id` = @conn_id,
|
||||
`thread_id` = @thread_id
|
||||
WHERE `pk` = 4;
|
||||
*** UPDATEing row with pk = 4 and `int1_key` +=4 if above statement succeeded (query log disabled)...
|
||||
COMMIT;
|
Reference in New Issue
Block a user