• Rahul Malik's avatar
    Bug#15851528 DUPLICATE KEY ERROR ON AUTO-INC PK WITH MIXED AUTO_INCREMENT_INCREMENT CLIENTS · 739f5239
    Rahul Malik authored
    Problem: Clients running different values for auto_increment_increment
    and doing concurrent inserts leads to "Duplicate key error" in one of them.
    
    Analysis:
    When auto_increment_increment value is reduced in a session,
    InnoDB uses last auto_increment_increment value
    to recalculate the autoinc value.
    In case, some other session has inserted a value
    with different auto_increment_increment, InnoDB recalculate
    autoinc values based on current session previous auto_increment_increment
    instead of considering the auto_increment_increment used for last insert
    across all session
    
    Fix:
    revert 7acdf29c
    a.k.a. 7c12a9e5
    as it causing the bug.
    
    Reviewed By:
    Bin <bin.x.su@oracle.com>
    Kevin <kevin.lewis@oracle.com>
    RB#21777
    
    Note: In MariaDB Server, earlier changes in
    ae5bc059
    for MDEV-533 require that the original test in
    mysql/mysql-server@1ccd472d63a042d3237a55f5827239164219ef7e
    be adjusted for MariaDB.
    
    Also, ef47b625 (MDEV-8827)
    had to be reverted after the upstream fix had been backported.
    739f5239
ha_innodb.cc 360 KB