mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
ha_innodb.cc:
Fix another bug introduced in 4.0.4 in AUTO_INCREMENT and deadlock or lock wait timeout sql/ha_innodb.cc: Fix another bug introduced in 4.0.4 in AUTO_INCREMENT and deadlock or lock wait timeout
This commit is contained in:
@ -1800,6 +1800,8 @@ ha_innobase::write_row(
|
|||||||
goto func_exit;
|
goto func_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Updated value to %lu + 1\n", (ulint)auto_inc);
|
||||||
|
|
||||||
dict_table_autoinc_update(prebuilt->table, auto_inc);
|
dict_table_autoinc_update(prebuilt->table, auto_inc);
|
||||||
} else {
|
} else {
|
||||||
srv_conc_enter_innodb(prebuilt->trx);
|
srv_conc_enter_innodb(prebuilt->trx);
|
||||||
@ -1865,8 +1867,12 @@ ha_innobase::write_row(
|
|||||||
introduced only in version 4.0.4.
|
introduced only in version 4.0.4.
|
||||||
NOTE that a REPLACE command handles a duplicate key error
|
NOTE that a REPLACE command handles a duplicate key error
|
||||||
itself, and we must not decrement the autoinc counter
|
itself, and we must not decrement the autoinc counter
|
||||||
if we are performing a REPLACE statement. This was fixed
|
if we are performing a REPLACE statement.
|
||||||
in 4.0.6. */
|
NOTE 2: if there was an error, for example a deadlock,
|
||||||
|
which caused InnoDB to roll back the whole transaction
|
||||||
|
already in the call of row_insert_for_mysql(), we may no
|
||||||
|
longer have the AUTO-INC lock, and cannot decrement
|
||||||
|
the counter here. */
|
||||||
|
|
||||||
skip_auto_inc_decr = FALSE;
|
skip_auto_inc_decr = FALSE;
|
||||||
|
|
||||||
@ -1876,11 +1882,13 @@ ha_innobase::write_row(
|
|||||||
&skip_auto_inc_decr);
|
&skip_auto_inc_decr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip_auto_inc_decr && incremented_auto_inc_counter) {
|
if (!skip_auto_inc_decr && incremented_auto_inc_counter
|
||||||
|
&& prebuilt->trx->auto_inc_lock) {
|
||||||
dict_table_autoinc_decrement(prebuilt->table);
|
dict_table_autoinc_decrement(prebuilt->table);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip_auto_inc_decr && incremented_auto_inc_for_stat) {
|
if (!skip_auto_inc_decr && incremented_auto_inc_for_stat
|
||||||
|
&& prebuilt->trx->auto_inc_lock) {
|
||||||
auto_inc_counter_for_this_stat--;
|
auto_inc_counter_for_this_stat--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user