mirror of
https://github.com/MariaDB/server.git
synced 2025-04-28 06:45:23 +03:00
This imports and adapts a number of MySQL 5.7 test cases that are applicable to MariaDB. Some tests for old bug fixes are not that relevant because the code has been refactored since then (especially starting with MariaDB Server 10.6), and the tests would not reproduce the original bug if the fix was reverted. In the test innodb_fts.opt, there are many duplicate MATCH ranks, which would make the results nondeterministic. The test was stabilized by changing some LIMIT clauses or by adding sorted_result in those cases where the purpose of a test was to show that no sorting took place in the server. In the test innodb_fts.phrase, MySQL 5.7 would generate FTS_DOC_ID that are 1 larger than in MariaDB. In innodb_fts.index_table the difference is 2. This is because in MariaDB, fts_get_next_doc_id() post-increments cache->next_doc_id, while MySQL 5.7 pre-increments it. Reviewed by: Thirunarayanan Balathandayuthapani
96 lines
2.3 KiB
Plaintext
96 lines
2.3 KiB
Plaintext
--source include/have_innodb.inc
|
|
|
|
#
|
|
# Test that transaction data is correctly "visualized" in
|
|
# INFORMATION_SCHEMA.INNODB_TRX
|
|
#
|
|
|
|
SET @save_timeout=@@GLOBAL.innodb_lock_wait_timeout;
|
|
SET GLOBAL innodb_lock_wait_timeout=100000000;
|
|
|
|
DESCRIBE INFORMATION_SCHEMA.INNODB_TRX;
|
|
|
|
CREATE TABLE t1 (
|
|
c01 INT,
|
|
c02 INT,
|
|
PRIMARY KEY (c01)
|
|
) ENGINE=INNODB STATS_AUTO_RECALC=0;
|
|
|
|
INSERT INTO t1 VALUES
|
|
(1,2),(2,4),(3,6),(4,8);
|
|
|
|
CREATE TABLE t2 (
|
|
c01 INT,
|
|
c02 INT,
|
|
PRIMARY KEY (c01),
|
|
FOREIGN KEY fk1 (c02) REFERENCES t1 (c01)
|
|
) ENGINE=INNODB STATS_AUTO_RECALC=0;
|
|
|
|
INSERT INTO t2 VALUES
|
|
(1,1),(2,2),(3,3);
|
|
|
|
-- source include/count_sessions.inc
|
|
|
|
-- connect (con_trx,localhost,root,,)
|
|
-- connect (con_verify_innodb_trx,localhost,root,,)
|
|
|
|
-- connection con_trx
|
|
SET autocommit=0;
|
|
INSERT INTO t1 VALUES (5,10);
|
|
SELECT * FROM t1 FOR UPDATE;
|
|
|
|
let $wait_timeout= 300;
|
|
let $wait_condition=
|
|
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TRX;
|
|
-- source include/wait_condition.inc
|
|
|
|
-- connection con_verify_innodb_trx
|
|
SELECT trx_state, trx_weight, trx_tables_in_use, trx_tables_locked,
|
|
trx_rows_locked, trx_rows_modified, trx_concurrency_tickets,
|
|
trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
|
|
FROM INFORMATION_SCHEMA.INNODB_TRX;
|
|
|
|
-- connection con_trx
|
|
ROLLBACK;
|
|
SET FOREIGN_KEY_CHECKS = 0;
|
|
SET UNIQUE_CHECKS = 0;
|
|
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES (6,12);
|
|
|
|
let $wait_timeout= 300;
|
|
let $wait_condition=
|
|
SELECT trx_unique_checks = 0 FROM INFORMATION_SCHEMA.INNODB_TRX;
|
|
-- source include/wait_condition.inc
|
|
|
|
-- connection con_verify_innodb_trx
|
|
SELECT trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
|
|
FROM INFORMATION_SCHEMA.INNODB_TRX;
|
|
|
|
-- connection con_trx
|
|
ROLLBACK;
|
|
SET FOREIGN_KEY_CHECKS = 1;
|
|
SET UNIQUE_CHECKS = 1;
|
|
BEGIN;
|
|
--error ER_NO_REFERENCED_ROW_2
|
|
INSERT INTO t2 VALUES (4,10);
|
|
|
|
let $wait_timeout= 300;
|
|
let $wait_condition=
|
|
SELECT trx_unique_checks = 1 FROM INFORMATION_SCHEMA.INNODB_TRX;
|
|
-- source include/wait_condition.inc
|
|
-- disconnect con_trx
|
|
|
|
-- connection con_verify_innodb_trx
|
|
SELECT trx_state, trx_isolation_level, trx_last_foreign_key_error
|
|
FROM INFORMATION_SCHEMA.INNODB_TRX;
|
|
-- disconnect con_verify_innodb_trx
|
|
|
|
-- connection default
|
|
DROP TABLE t2;
|
|
DROP TABLE t1;
|
|
|
|
-- source include/wait_until_count_sessions.inc
|
|
|
|
SET GLOBAL innodb_lock_wait_timeout=@save_timeout;
|