August 22, 2012

[MySQL Bug]bug#61209简析

转载请署名:印风 ————————————————— MySQL bug#61209,changelog如下,在5.5.23被fix InnoDB: Running concurrent bulk inserts on a server with auto_increment_offset=1,auto_increment_increment greater than 1, and innodb_autoinc_lock_mode=1 could result in intermittent errors like the following, even with the primary key set to auto_increment and omitted from the INSERT statement:   Duplicate entry ‘value’ for key ‘PRIMARY’ The workaround was to set auto_increment_offset=1 or innodb_autoinc_lock_mode=0 (“traditional”). (Bug #13817703, Bug #61209)   之前已经介绍过了innodb 如何处理auto inc的代码流程,现在来看看在innobase_next_autoinc里是如何来计算的。 […]

[MySQL Bug] bug#61579碎碎念

转载请署名:印风 ———————————————- MySQL bug#61579 changelog: InnoDB: For an InnoDB table with a trigger, under the setting innodb_autoinc_lock_mode=1, sometimes auto-increment values could be interleaved when inserting into the table from two sessions concurrently. The sequence of auto-increment values could vary depending on timing, leading to data inconsistency in systems using replication. (Bug #12752572, Bug #61579) 根据changelog的描述,当某个表上存在触发器时,并且innodb_autoinc_lock_mode=1,当两个session并发插入表时,自增列的值可能会产生交错。当使用statement记录时,会导致duplicate key错误,导致复制停止。 把触发器移除掉,则一切正常。 简单的gdb一把可以看出来,对于一条简单的插入语句,在函数handler::update_auto_increment中,当有trigger时,预估值 estimation_rows_to_insert值为0, […]