mariadb/mysql-test/suite/innodb/r/innodb-lock-inherit-read_commited.result
Marko Mäkelä 228b7e4db5 MDEV-13626 Merge InnoDB test cases from MySQL 5.7
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
2023-11-08 12:17:14 +02:00

124 lines
4.1 KiB
Text

#
# Bug #21025880 DUPLICATE UK VALUES IN READ-COMMITTED(AGAIN)
#
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL,
PRIMARY KEY(b),
UNIQUE KEY(a))
ENGINE=INNODB;
SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc;
SET GLOBAL innodb_stats_auto_recalc = OFF;
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
SET @old_tx_isolation = @@tx_isolation;
SET GLOBAL tx_isolation = 'READ-COMMITTED';
SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout = 1;
connect con1,localhost,root,,;
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1;
SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL
con1_locks_done WAIT_FOR con1_go';
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
con1_insert_done WAIT_FOR con1_finish';
REPLACE INTO t1 VALUES (1,2);
connect con2,localhost,root,,;
SET debug_sync = 'now WAIT_FOR con1_locks_done';
SET debug_sync = 'lock_wait_suspend_thread_enter SIGNAL con2_blocked
WAIT_FOR con2_go';
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock
WAIT_FOR con2_finish';
SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done';
REPLACE INTO t1 VALUES (1,3);
connection default;
SET debug_sync = 'now WAIT_FOR con2_blocked';
connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
InnoDB 0 transactions not purged
SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done';
SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done';
SET debug_sync = 'now SIGNAL con1_finish';
connection con1;
disconnect con1;
connection default;
SET debug_sync = 'now SIGNAL con2_finish';
connection con2;
disconnect con2;
connection default;
SET DEBUG_SYNC= 'RESET';
SELECT * FROM t1;
a b
1 2
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc;
SET GLOBAL tx_isolation = @old_tx_isolation;
SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL,
PRIMARY KEY(b),
UNIQUE KEY(a))
ENGINE=INNODB;
SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc;
SET GLOBAL innodb_stats_auto_recalc = OFF;
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
SET @old_tx_isolation = @@tx_isolation;
SET GLOBAL tx_isolation = 'READ-COMMITTED';
SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout = 1;
connect con1,localhost,root,,;
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1;
SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL
con1_locks_done WAIT_FOR con1_go';
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
con1_insert_done WAIT_FOR con1_finish';
INSERT INTO t1 values (1,2) ON DUPLICATE KEY UPDATE a=2;
connect con2,localhost,root,,;
SET debug_sync = 'now WAIT_FOR con1_locks_done';
SET debug_sync = 'lock_wait_suspend_thread_enter SIGNAL con2_blocked
WAIT_FOR con2_go';
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock
WAIT_FOR con2_finish';
SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done';
REPLACE INTO t1 VALUES (1,3);
connection default;
SET debug_sync = 'now WAIT_FOR con2_blocked';
connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
InnoDB 0 transactions not purged
SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done';
SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done';
SET debug_sync = 'now SIGNAL con1_finish';
connection con1;
disconnect con1;
connection default;
SET debug_sync = 'now SIGNAL con2_finish';
connection con2;
disconnect con2;
connection default;
SET DEBUG_SYNC= 'RESET';
SELECT * FROM t1;
a b
1 2
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc;
SET GLOBAL tx_isolation = @old_tx_isolation;
SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;