diff options
author | unknown <gkodinov@mysql.com> | 2006-06-13 18:18:32 +0300 |
---|---|---|
committer | unknown <gkodinov@mysql.com> | 2006-06-13 18:18:32 +0300 |
commit | 01c9fd31d7456827587b4ea00facb14317fdd81b (patch) | |
tree | 28c57dae5731b5f0ca9e5d47a0d941264f195dd0 /sql/sql_insert.cc | |
parent | 6474219467e8c72d8818efa27e20be1fc1047694 (diff) | |
download | mariadb-git-01c9fd31d7456827587b4ea00facb14317fdd81b.tar.gz |
Bug #20195: INSERT DELAYED with auto_increment is assigned wrong values
The INSERT DELAYED should not maintain its own private auto-increment
counter, because this is assuming that other threads cannot insert
into the table while the INSERT DELAYED thread is inserting, which is
a wrong assumption.
So the start of processing of a batch of INSERT rows in the
INSERT DELAYED thread must be treated as a start of a new statement
and cached next_insert_id must be cleared.
mysql-test/r/delayed.result:
test suite for the bug
mysql-test/t/delayed.test:
test suite for the bug
sql/sql_insert.cc:
Reset auto-increment cacheing before processing
the next batch of inserts in the handler thread
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 26f3b6f5faa..5630702fe52 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1938,6 +1938,14 @@ bool delayed_insert::handle_inserts(void) if (!using_bin_log) table->file->extra(HA_EXTRA_WRITE_CACHE); pthread_mutex_lock(&mutex); + + /* Reset auto-increment cacheing */ + if (thd.clear_next_insert_id) + { + thd.next_insert_id= 0; + thd.clear_next_insert_id= 0; + } + while ((row=rows.get())) { stacked_inserts--; |