summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorAnnamalai Gurusami <annamalai.gurusami@oracle.com>2012-05-21 17:25:40 +0530
committerAnnamalai Gurusami <annamalai.gurusami@oracle.com>2012-05-21 17:25:40 +0530
commite979417c06f98f8ca81a7442d93f53d9aec79446 (patch)
treecdded59831e98b188a31fdf181ebc18fa2e77b73 /sql/handler.cc
parent781137c0dddc3c9315a8d40e579fe82f6a900d61 (diff)
downloadmariadb-git-e979417c06f98f8ca81a7442d93f53d9aec79446.tar.gz
Bug #12752572 61579: REPLICATION FAILURE WHILE
INNODB_AUTOINC_LOCK_MODE=1 AND USING TRIGGER When an insert stmt like "insert into t values (1),(2),(3)" is executed, the autoincrement values assigned to these three rows are expected to be contiguous. In the given lock mode (innodb_autoinc_lock_mode=1), the auto inc lock will be released before the end of the statement. So to make the autoincrement contiguous for a given statement, we need to reserve the auto inc values at the beginning of the statement. Modified the fix based on review comment by Svoj.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 20bf2355c25..9e43d5aba93 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2398,18 +2398,18 @@ int handler::update_auto_increment()
Note that in prelocked mode no estimation is given.
*/
- /*
- For multi-row inserts, if the bulk inserts cannot be started, the
- handler::estimation_rows_to_insert will not be set. Set it here.
- */
- if ((estimation_rows_to_insert == 0) &&
- (thd->lex->many_values.elements > 0))
- {
- estimation_rows_to_insert= thd->lex->many_values.elements;
- }
-
if ((auto_inc_intervals_count == 0) && (estimation_rows_to_insert > 0))
nb_desired_values= estimation_rows_to_insert;
+ else if ((auto_inc_intervals_count == 0) &&
+ (thd->lex->many_values.elements > 0))
+ {
+ /*
+ For multi-row inserts, if the bulk inserts cannot be started, the
+ handler::estimation_rows_to_insert will not be set. But we still
+ want to reserve the autoinc values.
+ */
+ nb_desired_values= thd->lex->many_values.elements;
+ }
else /* go with the increasing defaults */
{
/* avoid overflow in formula, with this if() */