Commit f638ee6d authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi
Browse files

Added code to flush a bulk_insert index.

This fixes a bug when doing multi-row inserts on table with an auto_increment key that is not in the first key segment.
parent dfd0f82b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -50442,6 +50442,12 @@ each individual 4.0.x release.
@itemize @bullet
@item
Fixed bug when doing a multi-line insert on a table with an
auto_increment key which was not in the first part of the key.
@item
Changed @code{LOAD DATA INFILE} to not recreate index if the table had
rows from before.
@item
Fixed overrun bug when calling @code{AES_DECRYPT()} with wrong arguments
@item
@code{--skip-ssl} can now be used to disable SSL in the MySQL clients,
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ enum ha_extra_function {
  HA_EXTRA_NO_IGNORE_DUP_KEY,
  HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE,	/* Cursor will not be used for update */
  HA_EXTRA_BULK_INSERT_BEGIN,
  HA_EXTRA_BULK_INSERT_FLUSH,		/* Flush one index */
  HA_EXTRA_BULK_INSERT_END,
  HA_EXTRA_PREPARE_FOR_DELETE
};
+11 −1
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@
		HA_EXTRA_CACHE
		HA_EXTRA_BULK_INSERT_BEGIN
		  If extra_arg is 0, then the default cache size is used.
		HA_EXTRA_BULK_INSERT_FLUSH
		  extra_arg is a a pointer to which index to flush (uint*)
    RETURN VALUES
    0	ok
*/
@@ -356,6 +358,14 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
    error=_mi_init_bulk_insert(info, (extra_arg ? *(ulong*) extra_arg :
				      myisam_bulk_insert_tree_size));
    break;
  case HA_EXTRA_BULK_INSERT_FLUSH:
    if (info->bulk_insert)
    {
      uint index_to_flush= *(uint*) extra_arg;
      if (is_tree_inited(&info->bulk_insert[index_to_flush]))
	reset_tree(&info->bulk_insert[index_to_flush]);
    }
    break;
  case HA_EXTRA_BULK_INSERT_END:
    if (info->bulk_insert)
    {
+8 −0
Original line number Diff line number Diff line
@@ -41,6 +41,14 @@ a t>0 c i
5	0	a	NULL
6	1	hello	NULL
drop table t1;
create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id));
insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL);
select * from t1;
sid	id
skr	1
skr	2
test	1
drop table t1;
drop database if exists foo;
create database foo;
use foo;
+9 −0
Original line number Diff line number Diff line
@@ -39,6 +39,15 @@ insert into t1 set a=default,t=default,c=default,i=default;
select a,t>0,c,i from t1;
drop table t1;

#
# Test problem with bulk insert and auto_increment on second part keys
#

create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id));
insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL);
select * from t1;
drop table t1;

#
# Test of mysqld crash with fully qualified column names
#
Loading