Bug #31089 InnoDB unsafe binlog test fails with wrong error

Submitted: 18 Sep 2007 21:20 Modified: 19 Sep 2007 1:04
Reporter: Joshua Kugler (Basic Quality Contributor) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.45 OS:Linux (Debian Sarge)
Assigned to: Heikki Tuuri CPU Architecture:Any

[18 Sep 2007 21:20] Joshua Kugler
Description:
When running 'make test' I get this:

Errors are (from /home/jkugler/src/mysql-5.0.45/mysql-test/var/log/mysqltest-time) :
mysqltest: At line 59: query 'select * from t1 where a = 2 and b = 2 for update' succeeded - should have failed with errno 1205...
(the last lines may be the most important ones)
Result from queries before failure can be found in r/innodb_unsafe_binlog.log

The log contains:

drop table if exists t1,t2;
create table t1 (id int not null, f_id int not null, f int not null,
primary key(f_id, id)) engine=innodb;
create table t2 (id int not null,s_id int not null,s varchar(200),
primary key(id)) engine=innodb;
INSERT INTO t1 VALUES (8, 1, 3);
INSERT INTO t1 VALUES (1, 2, 1);
INSERT INTO t2 VALUES (1, 0, '');
INSERT INTO t2 VALUES (8, 1, '');
commit;
DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
WHERE mm.id IS NULL;
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
where mm.id is null lock in share mode;
id      f_id    f
drop table t1,t2;
create table t1 (id int not null, f_id int not null, f int not null,
primary key(id),key(f_id)) engine=innodb;
create table t2 (id int not null,s_id int not null,s varchar(200),
primary key(id),key(s_id)) engine=innodb;
INSERT INTO t1 VALUES (8, 1, 3);
INSERT INTO t1 VALUES (1, 2, 1);
INSERT INTO t2 VALUES (1, 0, '');
INSERT INTO t2 VALUES (8, 1, '');
commit;
delete ml.* from t1 as ml left join t2 as mm on (mm.s_id=ml.f_id) where mm.s is null;
select ml.* from t1 as ml left join t2 as mm on (mm.s_id=ml.f_id) where mm.s is null lock in share mode;
id      f_id    f
drop table t1,t2;
create table t1(a int not null, b int, primary key(a)) engine=innodb;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
commit;
set autocommit = 0;
select * from t1 lock in share mode;
a       b
1       1
2       2
3       1
4       2
5       1
6       2
update t1 set b = 5 where b = 1;
set autocommit = 0;
select * from t1 where a = 2 and b = 2 for update;
a       b
2       2

My configure spec:

CFLAGS="-O3 -DPIC -fPIC -DUNDEF_HAVE_INITGROUPS -fno-strict-aliasing" CXXFLAGS="-O3 -fno-strict-aliasing -felide-constructors -fno-exceptions -fno-rtti -fPIC -DPIC -DUNDEF_HAVE_INITGROUPS" ./configure --prefix=/usr/local/ --enable-thread-safe-client --enable-assember --with-server-suffix=eei --with-unix-socket-path=/usr/local/tmp/mysql5.sock --with-tcp-port=3307 --with-mysqld-user=mysql5 --without-bench --without-debug --with-example-storage-engine --with-archive-storage-engine --with-csv-storage-engine --with-blackhole-storage-engine --with-federated-storage-engine --with-extra-charsets=all

How to repeat:
Use the above configure spec and make;make test.
[18 Sep 2007 23:14] Joshua Kugler
Corrected Debian version
[19 Sep 2007 1:04] Joshua Kugler
Upon further investigation, all tests pass if -O0 (no optimization) is used.  It seems optimization is breaking something.

$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --enable-__cxa_atexit --with-system-zlib --enable-nls --without-included-gettext --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-13)

Hmm, it turns out this seems to be a gcc related bug.  Compiling on Ubuntu Dapper (gcc 4.0.3) with -O3 produces a binary that passes all tests.

I'm closing the bug as "not a bug." Sorry for the noise.
[19 Sep 2007 11:54] Heikki Tuuri
Maybe the test is timing-dependent.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.