Below is the list of changes that have just been committed into a local
5.0 repository of aelkin. When aelkin 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@stripped, 2008-03-19 16:06:53+02:00, aelkin@mysql1000.(none) +3 -0
Bug #35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables
binlogging of insert into a autoincrement blackhole table ignored
an explicit set insert_id.
Fixed with refining of the blackhole's insert method to call
update_auto_increment() that prepares binlogging the insert query
with the preceeding set insert_id.
Note, as the engine does not store any actual data one has to explicitly
provide to the server with the value of the autoincrement column via
set insert_id. Otherwise binlogging will happend with the default
set insert_id=1.
mysql-test/r/blackhole.result@stripped, 2008-03-19 16:06:49+02:00, aelkin@mysql1000.(none) +17 -0
results changed
mysql-test/t/blackhole.test@stripped, 2008-03-19 16:06:49+02:00, aelkin@mysql1000.(none) +24 -2
a regression test for the bug added
sql/ha_blackhole.cc@stripped, 2008-03-19 16:06:50+02:00, aelkin@mysql1000.(none) +1 -1
blackhole's insert method is refined to call update_auto_increment()
that prepares binlogging the insert query with the preceeding set insert_id.
diff -Nrup a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result
--- a/mysql-test/r/blackhole.result 2008-01-30 12:25:24 +02:00
+++ b/mysql-test/r/blackhole.result 2008-03-19 16:06:49 +02:00
@@ -138,3 +138,20 @@ ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD PRIMARY KEY(a);
DELETE FROM t1 WHERE a=10;
DROP TABLE t1;
+reset master;
+create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
+insert into t1 values (NULL);
+set insert_id= 3;
+insert into t1 values (NULL);
+set insert_id= 5;
+insert into t1 values (NULL);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole
+master-bin.000001 # Intvar 1 # INSERT_ID=1
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Intvar 1 # INSERT_ID=3
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Intvar 1 # INSERT_ID=5
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+drop table t1;
diff -Nrup a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
--- a/mysql-test/t/blackhole.test 2008-01-30 12:25:24 +02:00
+++ b/mysql-test/t/blackhole.test 2008-03-19 16:06:49 +02:00
@@ -142,7 +142,6 @@ CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
INSERT DELAYED INTO t1 VALUES(1);
DROP TABLE t1;
-# End of 4.1 tests
#
#Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX
@@ -159,4 +158,27 @@ ALTER TABLE t1 ADD PRIMARY KEY(a);
DELETE FROM t1 WHERE a=10;
DROP TABLE t1;
-# End of 5.0 tests
+#
+# Bug#35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables
+#
+#
+# the test checks that explicitly prescribed with set insert_id= value
+# preceeds the following autoincrement insert in a blachhole
+#
+
+reset master;
+create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
+
+# not insert_id prescribed insert expands NULL into default 1
+insert into t1 values (NULL);
+set insert_id= 3;
+insert into t1 values (NULL);
+set insert_id= 5;
+insert into t1 values (NULL);
+source include/show_binlog_events2.inc;
+
+# cleanup
+drop table t1;
+
+
+# End of tests
diff -Nrup a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc
--- a/sql/ha_blackhole.cc 2007-12-13 21:46:28 +02:00
+++ b/sql/ha_blackhole.cc 2008-03-19 16:06:50 +02:00
@@ -115,7 +115,7 @@ const char *ha_blackhole::index_type(uin
int ha_blackhole::write_row(byte * buf)
{
DBUG_ENTER("ha_blackhole::write_row");
- DBUG_RETURN(0);
+ DBUG_RETURN(table->next_number_field ? update_auto_increment() : 0);
}
int ha_blackhole::rnd_init(bool scan)
| Thread |
|---|
| • bk commit into 5.0 tree (aelkin:1.2598) BUG#35178 | Andrei Elkin | 19 Mar |