mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fix for BUG#31612
"Trigger fired multiple times leads to gaps in auto_increment sequence". The bug was that if a trigger fired multiple times inside a top statement (for example top-statement is a multi-row INSERT, and trigger is ON INSERT), and that trigger inserted into an auto_increment column, then gaps could be observed in the auto_increment sequence, even if there were no other users of the database (no concurrency). It was wrong usage of THD::auto_inc_intervals_in_cur_stmt_for_binlog. Note that the fix changes "class handler", I'll tell the Storage Engine API team.
This commit is contained in:
@@ -1129,6 +1129,13 @@ public:
|
||||
inserter.
|
||||
*/
|
||||
Discrete_interval auto_inc_interval_for_cur_row;
|
||||
/**
|
||||
Number of reserved auto-increment intervals. Serves as a heuristic
|
||||
when we have no estimation of how many records the statement will insert:
|
||||
the more intervals we have reserved, the bigger the next one. Reset in
|
||||
handler::ha_release_auto_increment().
|
||||
*/
|
||||
uint auto_inc_intervals_count;
|
||||
|
||||
handler(handlerton *ht_arg, TABLE_SHARE *share_arg)
|
||||
:table_share(share_arg), table(0),
|
||||
@@ -1137,7 +1144,8 @@ public:
|
||||
ref_length(sizeof(my_off_t)),
|
||||
ft_handler(0), inited(NONE),
|
||||
locked(FALSE), implicit_emptied(0),
|
||||
pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0)
|
||||
pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0),
|
||||
auto_inc_intervals_count(0)
|
||||
{}
|
||||
virtual ~handler(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user