[MDEV-20202] InnoDB could generate duplicate AUTO_INC values Created: 2019-07-29  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2.26, 10.1.41, 10.3.17, 10.4.7
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Matthias Leich Assignee: Marko Mäkelä
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File MDEV-20202.tgz     HTML File prt    

 Description   

The testcase was derived from
   https://bugs.mysql.com/bug.php?id=88321
and especially
   https://bugs.mysql.com/file.php?id=26087&bug_id=88321&text=1
I changed a lot within the mechanics in order to have finally some
handy test using MTR + the mysql client.
 
Scenario
-------------
The table definition is
CREATE TABLE test (
   test_id int(11) NOT NULL AUTO_INCREMENT,
   testcol varchar(256) COLLATE utf8_bin NOT NULL,
   PRIMARY KEY (test_id) )
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
Two "worker" run concurrent a big number of loops containing
    INSERT INTO test (testcol) VALUES ('test123');
    .... Initiate the abort of the test in case that fails
    # The RELEASE is essential.
    COMMIT WORK RELEASE;
   # Dummy statement for detecting the loss of the connection
   COMMIT ;
   ... get a reconnect ...
 
One "mad DBA" runs concurrent to the two "worker" above a big number of loops containing
    SET @@GLOBAL.auto_increment_increment = 1;
    sleep 0.1;
    SET @@GLOBAL.auto_increment_increment = 2;
    sleep 0.1;
 
After around ~ 20s one of the two sessions initiates the abort because it
harvested something like a
ERROR 23000: Duplicate entry '331' for key 'PRIMARY'
 
10.1 commit 403e6615fdd3f5f4de6d159457b2bd2fe566e0ad 2019-07-26
bb-10.1-release commit 4177181e1617df185397ea275ee98eb4d50a0b8b 2019-07-26
    # It was told that bb-10.1-release might contain a fix which fixes one or
    # more weaknesses around AUTO_INCREMENT value generation.
10.2 / 10.3 / 10.4 2019-07



 Comments   
Comment by Matthias Leich [ 2019-07-29 ]

prt == The output of MTR during my test run on 10.1.
 
MDEV-20202.tgz == Archive with MTR based replay test case
 
How to replay the problem:
0. Use a Linux
1. cd <source>/mysql-test
2. tar xvzf MDEV-20202.tgz
    This unpacks a
    mysqltest_background.sh
    suite/innodb/t/ml_MDEV-8827_2.test
3. cd <tree_with_binaries compiled with debug>/mysql-test
4. ./mysql-test-run.pl --mem ml_MDEV-8827_2
 
 
 
Please do not add my replay test case to the regression tests because
it consumes too much resources. 
 
A perfect regression test should use debug_sync or similar.

Generated at Thu Feb 08 08:57:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.