Bug 82771

Summary: Setting "BUILD_OPTIMIZED=yes" breaks ports databases/mysql40-server and .../mysql41-server on Alpha arch
Product: Ports & Packages Reporter: xenophon+fbsdports
Component: Individual Port(s)Assignee: Alex Dupre <ale>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description xenophon+fbsdports 2005-06-29 12:20:21 UTC
Setting "BUILD_OPTIMIZED=yes" for the databases/mysql40-server and
databases/mysql41-server ports breaks MySQL on my hardware platform
(I presume no one on x86 had this problem, or at least nothing was
mentioned in a cursory web/bug DB search).

I think the problem is for integer columns with a uniqueness constraint
(e.g. primary keys), MySQL updates the index but the fails to set the
row column value (instead, it assigns the default value).  This results
in strange behavior where one can successfully insert a value, but one
cannot select/update that value, and if one attempts inserting the same
value, MySQL returns an exception because the second insert violated the
uniqueness constraint (which is likely checked through a fast (cached)
index lookup instead of a slow row lookup).

I think a compiler optimization setting that is incompatible with the
hardware platform causes this problem, perhaps due to a bug in the
compiler tool chain or in the language run-time environment.  I
recompiled MySQL without optimization, and this corrected the problem.

(I marked the severity as "Critical" because this bug completely breaks
MySQL, however I marked the priority low because this combination of
hardware and operating system is somewhat rare.)

Fix: 

Would the port maintainer cause each port's Makefile to check for the
combination of a non-x86 platform and the BUILD_OPTIMIZED flag and to
set BROKEN or IGNORE or somehow return an error?
How-To-Repeat: 
On a computer running FreeBSD/alpha 5.4-RELEASE, while logged in as root:

cd /usr/ports/databases/mysql41-server
make install BUILD_OPTIMIZED=yes
make clean
/usr/local/etc/rc.d/mysql-server.sh start

Then, attempt to install and run a database application such as MediaWiki
or Snort (security/snort).  In the case of Snort, it will attempt to
register itself in its "sensor" table with an ID of 1, but reading the
contents of this table shows a sensor ID of 0.  Attempting to update this
value fails, and attempting to insert a row with a sensor ID of 1 fails
with a uniqueness constraint error.

I did not have time to test MySQL 5.0.
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2005-06-29 21:40:02 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale


Assign to maintainer.
Comment 2 Alex Dupre freebsd_committer freebsd_triage 2006-01-17 07:10:54 UTC
State Changed
From-To: open->feedback

Is this still a problem? Have you tried 5.0?
Comment 3 Alex Dupre freebsd_committer freebsd_triage 2006-03-30 07:19:52 UTC
State Changed
From-To: feedback->closed

No feedback.