diff options
author | Annamalai Gurusami <annamalai.gurusami@oracle.com> | 2012-05-16 11:17:48 +0530 |
---|---|---|
committer | Annamalai Gurusami <annamalai.gurusami@oracle.com> | 2012-05-16 11:17:48 +0530 |
commit | bcb5d73767fbc04c88d3c8b05eafbdc9a905ea1f (patch) | |
tree | 4f97f9a2fae74604dcc402991aea8cf3b4029058 /sql/handler.cc | |
parent | 5d8b38df4c6166bb7f52d6602c2b7eb48628c233 (diff) | |
download | mariadb-git-bcb5d73767fbc04c88d3c8b05eafbdc9a905ea1f.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.
rb://1074 approved by Alexander Nozdrin
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index d2eaab19ad8..20bf2355c25 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2397,6 +2397,17 @@ int handler::update_auto_increment() reservation means potentially losing unused values). 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 /* go with the increasing defaults */ @@ -4690,6 +4701,8 @@ int handler::ha_write_row(uchar *buf) DBUG_RETURN(error); if (unlikely(error= binlog_log_row(table, 0, buf, log_func))) DBUG_RETURN(error); /* purecov: inspected */ + + DEBUG_SYNC_C("ha_write_row_end"); DBUG_RETURN(0); } |