List:Internals« Previous MessageNext Message »
From:Martin Skold Date:April 8 2005 4:49pm
Subject:bk commit into 5.0 tree (mskold:1.1889) BUG#9675
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marty. When marty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1889 05/04/08 16:49:14 mskold@stripped +4 -0
  Merge from fix of Bug #9675  Auto-increment not working with INSERT..SELECT and NDB
storage

  sql/ha_ndbcluster.cc
    1.171 05/04/08 16:48:57 mskold@stripped +13 -1
    Merge from fix of Bug #9675  Auto-increment not working with INSERT..SELECT and NDB
storage

  mysql-test/t/ndb_basic.test
    1.25 05/04/08 16:48:57 mskold@stripped +27 -0
    Merge from fix of Bug #9675  Auto-increment not working with INSERT..SELECT and NDB
storage

  mysql-test/r/ndb_basic.result
    1.24 05/04/08 16:48:57 mskold@stripped +60 -0
    Merge from fix of Bug #9675  Auto-increment not working with INSERT..SELECT and NDB
storage

  mysql-test/r/ndb_alter_table.result
    1.26 05/04/08 16:48:57 mskold@stripped +1 -1
    Merge from fix of Bug #9675  Auto-increment not working with INSERT..SELECT and NDB
storage

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mskold
# Host:	blowfish.ndb.mysql.com
# Root:	/usr/local/home/marty/MySQL/mysql-5.0-build

--- 1.25/mysql-test/r/ndb_alter_table.result	Wed Mar  9 13:37:15 2005
+++ 1.26/mysql-test/r/ndb_alter_table.result	Fri Apr  8 16:48:57 2005
@@ -40,7 +40,7 @@
 (0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7),
(7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7),
(99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
 show table status;
 Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
-t1	ndbcluster	10	Dynamic	9	96	#	#	0	#	101	#	#	#	latin1_swedish_ci	NULL		#
+t1	ndbcluster	10	Dynamic	9	96	#	#	0	#	102	#	#	#	latin1_swedish_ci	NULL		#
 select * from t1 order by col1;
 col1	col2	col3	col4	col5	col6	to_be_deleted
 0	4	3	5	PENDING	1	7

--- 1.23/mysql-test/r/ndb_basic.result	Mon Feb  7 11:17:08 2005
+++ 1.24/mysql-test/r/ndb_basic.result	Fri Apr  8 16:48:57 2005
@@ -607,3 +607,63 @@
 engine=ndb
 max_rows=1;
 drop table t1;
+create table t1
+(counter int(64) NOT NULL auto_increment,
+datavalue char(40) default 'XXXX',
+primary key (counter)
+) ENGINE=ndbcluster;
+insert into t1 (datavalue) values ('newval');
+insert into t1 (datavalue) values ('newval');
+select * from t1 order by counter;
+counter	datavalue
+1	newval
+2	newval
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+select * from t1 order by counter;
+counter	datavalue
+1	newval
+2	newval
+3	newval
+4	newval
+5	newval
+6	newval
+7	newval
+8	newval
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+select * from t1 order by counter;
+counter	datavalue
+1	newval
+2	newval
+3	newval
+4	newval
+5	newval
+6	newval
+7	newval
+8	newval
+35	newval
+36	newval
+37	newval
+38	newval
+39	newval
+40	newval
+41	newval
+42	newval
+43	newval
+44	newval
+45	newval
+46	newval
+47	newval
+48	newval
+49	newval
+50	newval
+51	newval
+52	newval
+53	newval
+54	newval
+55	newval
+56	newval
+57	newval
+58	newval
+drop table t1;

--- 1.24/mysql-test/t/ndb_basic.test	Mon Feb  7 13:26:12 2005
+++ 1.25/mysql-test/t/ndb_basic.test	Fri Apr  8 16:48:57 2005
@@ -577,3 +577,30 @@
   engine=ndb
   max_rows=1;
 drop table t1;
+
+#
+# Test auto_increment
+#
+
+connect (con1,localhost,,,test);
+connect (con2,localhost,,,test);
+
+create table t1
+	(counter int(64) NOT NULL auto_increment,
+	 datavalue char(40) default 'XXXX',
+	 primary key (counter)
+	) ENGINE=ndbcluster;
+
+connection con1;
+insert into t1 (datavalue) values ('newval');
+insert into t1 (datavalue) values ('newval');
+select * from t1 order by counter;
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+select * from t1 order by counter;
+connection con2;
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+insert into t1 (datavalue) select datavalue from t1 where counter < 100;
+select * from t1 order by counter;
+
+drop table t1;

--- 1.170/sql/ha_ndbcluster.cc	Wed Apr  6 12:27:39 2005
+++ 1.171/sql/ha_ndbcluster.cc	Fri Apr  8 16:48:57 2005
@@ -1919,8 +1919,12 @@
 
     if (has_auto_increment) 
     {
+      THD *thd= table->in_use;
+
       m_skip_auto_increment= FALSE;
       update_auto_increment();
+      /* Ensure that handler is always called for auto_increment values */
+      thd->next_insert_id= 0;
       m_skip_auto_increment= !auto_increment_column_changed;
     }
 
@@ -2970,7 +2974,11 @@
   DBUG_PRINT("enter", ("rows: %d", (int)rows));
   
   m_rows_inserted= 0;
-  m_rows_to_insert= rows; 
+  if (rows == 0)
+    /* We don't know how many will be inserted, guess */
+    m_rows_to_insert= m_autoincrement_prefetch;
+  else
+    m_rows_to_insert= rows; 
 
   /* 
     Calculate how many rows that should be inserted
@@ -4080,6 +4088,10 @@
   DBUG_ENTER("get_auto_increment");
   DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
   Ndb *ndb= get_ndb();
+   
+  if (m_rows_inserted > m_rows_to_insert)
+    /* We guessed too low */
+    m_rows_to_insert+= m_autoincrement_prefetch;
   cache_size= 
     (m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
     m_rows_to_insert - m_rows_inserted 
Thread
bk commit into 5.0 tree (mskold:1.1889) BUG#9675Martin Skold8 Apr