Debian Codegraph @

mysql-test/suite/engines/rr_trx/check_consistency.sql

raw
1 USE test;
2 -- This file contains queries that can be used to check table consistency after running the stress_tx_rr test suite.
3 -- Contains a mix of queries used throughout the actual test suite.
4 -- When server is running, run this script e.g. like this:
5 -- ./bin/mysql -v -u root -h 127.0.0.1 < mysql-test/suite/engines/rr_trx/check_consistency.sql
6
7 CHECK TABLE t1;
8 ANALYZE TABLE t1;
9
10 -- Sum of all integers that are part of the test data should be 0
11 SELECT SUM(`int1` + `int1_key` + `int1_unique`
12 + `int2` + `int2_key` + `int2_unique`)
13 AS TotalSum
14 FROM t1;
15
16 -- No uncommitted data should be visible to a REPEATABLE-READ transaction
17 SELECT * FROM t1 WHERE `is_uncommitted` = 1;
18
19 -- No rows marked as consistent should have row-sum not equal to 0
20 SELECT * FROM t1 WHERE @sum:=`int1` + `int1_key` + `int1_unique` + `int2` + `int2_key` + `int2_unique` <> 0 AND `is_consistent` = 1;
21
22 -- Check the table count. SHOULD NOT BE 0.
23 SELECT COUNT(*) FROM t1;
24
25 -- The count of rows with pk divisible by 5 should be constant.
26 -- (less useful when there is no concurrency, though)
27 SELECT COUNT(*) FROM t1 WHERE `pk` MOD 5 = 0 AND `pk` BETWEEN 1 AND 1000;
28
29 -- Check statistics (any number is OK, we are only looking for an impractical amount of errors
30 SELECT * FROM statistics;
31