diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2008-10-06 16:06:59 +0200 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2008-10-06 16:06:59 +0200 |
commit | f8670e2c53dbd38fab2b5fd4c28025fb0f48a9ed (patch) | |
tree | 8b322cd1624911449002f4a3749fbc58181d2648 /sql/handler.h | |
parent | 0b097b777768f6a01d02411f7b78e4fce9e55a45 (diff) | |
download | mariadb-git-f8670e2c53dbd38fab2b5fd4c28025fb0f48a9ed.tar.gz |
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.
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/handler.h b/sql/handler.h index 3c5db8a0dff..b943e188962 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -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) { |