Debian Codegraph @

mysql-test/suite/innodb/t/alter_table_rebuild_duplicate_record.test

raw
1 # Save the initial number of concurrent sessions
2 --source include/count_sessions.inc
3
4 --source include/have_debug.inc
5 --source include/have_debug_sync.inc
6
7 --enable_connect_log
8 --connect (con1, localhost, root,,)
9 --echo #
10 --echo # Bug#36808088 Inplace ALTER TABLE might fail with duplicate key error
11 --echo # if concurrent insertions
12 --echo #
13
14 --connection default
15 CREATE TABLE t1 (pk CHAR(5) PRIMARY KEY);
16 INSERT INTO t1 VALUES ('aaaaa'), ('bbbbb'), ('ccccc'), ('ddddd'), ('eeeee');
17
18 --connection con1
19 SET DEBUG='+d,ddl_buf_add_two';
20 SET DEBUG_SYNC='ddl_bulk_inserter_latches_released SIGNAL latches_released WAIT_FOR go';
21 --echo # Send ALTER TABLE INPLACE which rebuilds table.
22 --send ALTER TABLE t1 ENGINE=InnoDB, ALGORITHM=INPLACE
23
24 --connection default
25 SET DEBUG_SYNC='now WAIT_FOR latches_released';
26 INSERT INTO t1 VALUES ('ccaaa');
27 SET DEBUG_SYNC='now SIGNAL go';
28
29 --connection con1
30 --echo # Reap ALTER TABLE
31 --echo # Before fix it failed with duplicate key error.
32 --reap
33 # Verify the expected records are available
34 SELECT COUNT(*) FROM t1;
35
36 --echo # Test Cleanup.
37 SET DEBUG_SYNC= 'RESET';
38 --connection default
39 SET DEBUG_SYNC= 'RESET';
40 DROP TABLE t1;
41
42 --echo #
43 --echo # Cleanup
44 --disconnect con1
45 --disable_connect_log
46 # Wait till all disconnects are completed
47 --source include/wait_until_count_sessions.inc
48