4872 Martin Skold 2012-03-07
Bug#13731134 AUTO-INC COUNTER IS NOT UPDATED WITH EXPLICIT @@INSERT_ID SET: Setting auto_increment in Ndb directly
modified:
mysql-test/suite/ndb/r/ndb_auto_increment.result
mysql-test/suite/ndb/t/ndb_auto_increment.test
sql/ha_ndbcluster.cc
4871 Mauritz Sundell 2012-03-07
ndb - fix of signal log serialization
Previously, setting NDB_SIGNAL_LOG_MUTEX can be used to serialize writes
to signal log, that protects against interleaving several signal
descriptions with each other. But flush request was not serialized,
leading to potential loss or repetition of parts of signal descriptions.
Now, both flushes and writes are serialized when NDB_SIGNAL_LOG_MUTEX
are set.
modified:
storage/ndb/src/common/debugger/SignalLoggerManager.cpp
=== 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 08:03:56 +0000
+++ b/sql/ha_ndbcluster.cc 2012-03-07 12:19:58 +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());
}
/*
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (Martin.Skold:4871 to 4872)Bug#13731134 | Martin Skold | 8 Mar |