From: Martin Skold Date: March 7 2012 12:29pm Subject: bzr push into mysql-5.1-telco-7.1 branch (Martin.Skold:4476 to 4477) List-Archive: http://lists.mysql.com/commits/143123 Message-Id: <20120307122911.AB8399F8154@quadfish> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4477 Martin Skold 2012-03-07 [merge] Merge from 70 modified: mysql-test/suite/ndb/r/ndb_auto_increment.result mysql-test/suite/ndb/t/ndb_auto_increment.test sql/ha_ndbcluster.cc storage/ndb/src/common/debugger/SignalLoggerManager.cpp 4476 Craig L Russell 2012-03-06 Fake commit to force club rebuild === modified file 'mysql-test/suite/ndb/r/ndb_auto_increment.result' --- a/mysql-test/suite/ndb/r/ndb_auto_increment.result 2011-09-15 09:12:39 +0000 +++ b/mysql-test/suite/ndb/r/ndb_auto_increment.result 2012-03-07 12:19:58 +0000 @@ -536,3 +536,26 @@ SELECT id from t1; id 3 DROP TABLE t1; +create table t1 (a serial) engine ndb; +set @@insert_id=1; +insert into t1 values(null); +insert into t1 values(null); +insert into t1 values(null); +insert into t1 values(null); +set @@insert_id=17; +insert into t1 values(null); +insert into t1 values(null); +insert into t1 values(null); +select * from t1 order by a; +a +1 +2 +3 +4 +17 +18 +19 +set @@insert_id=1; +insert into t1 values(null); +ERROR 23000: Duplicate entry '1' for key 'a' +drop table t1; === modified file 'mysql-test/suite/ndb/t/ndb_auto_increment.test' --- a/mysql-test/suite/ndb/t/ndb_auto_increment.test 2011-09-15 09:12:39 +0000 +++ b/mysql-test/suite/ndb/t/ndb_auto_increment.test 2012-03-07 12:19:58 +0000 @@ -429,3 +429,30 @@ INSERT IGNORE INTO t1 (data) VALUES (6), SELECT id from t1; DROP TABLE t1; + +# +# Bug #13731134 AUTO-INC COUNTER IS NOT UPDATED WITH EXPLICIT @@INSERT_ID SET +# + +create table t1 (a serial) engine ndb; + +set @@insert_id=1; +insert into t1 values(null); + +connection server2; + +insert into t1 values(null); +insert into t1 values(null); +insert into t1 values(null); +set @@insert_id=17; +insert into t1 values(null); +insert into t1 values(null); +insert into t1 values(null); +select * from t1 order by a; + +set @@insert_id=1; +--error ER_DUP_ENTRY +insert into t1 values(null); + +connection server1; +drop table t1; === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2012-02-17 09:38:57 +0000 +++ b/sql/ha_ndbcluster.cc 2012-03-07 12:28:35 +0000 @@ -4444,7 +4444,8 @@ int ha_ndbcluster::ndb_write_row(uchar * m_skip_auto_increment= FALSE; if ((error= update_auto_increment())) DBUG_RETURN(error); - m_skip_auto_increment= (insert_id_for_cur_row == 0); + m_skip_auto_increment= (insert_id_for_cur_row == 0 || + thd->auto_inc_intervals_forced.nb_elements()); } /* === modified file 'storage/ndb/src/common/debugger/SignalLoggerManager.cpp' --- a/storage/ndb/src/common/debugger/SignalLoggerManager.cpp 2012-01-16 07:14:30 +0000 +++ b/storage/ndb/src/common/debugger/SignalLoggerManager.cpp 2012-03-07 11:50:14 +0000 @@ -67,8 +67,11 @@ SignalLoggerManager::~SignalLoggerManage FILE * SignalLoggerManager::setOutputStream(FILE * output) { - if(outputStream != 0){ + if (outputStream != 0) + { + lock(); fflush(outputStream); + unlock(); } FILE * out = outputStream; @@ -85,8 +88,12 @@ SignalLoggerManager::getOutputStream() c void SignalLoggerManager::flushSignalLog() { - if(outputStream != 0) + if (outputStream != 0) + { + lock(); fflush(outputStream); + unlock(); + } } void No bundle (reason: useless for push emails).