Bug #51048 intrinsics in ndbmt don't link with /DEBUG
Submitted: 10 Feb 2010 6:29 Modified: 25 Feb 2010 14:28
Reporter: jack andrews Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-7.0 OS:Windows
Assigned to: jack andrews CPU Architecture:Any

[10 Feb 2010 6:29] jack andrews
Description:
note configuration is "Debug"

9>------ Build started: Project: ndbmtd, Configuration: Debug Win32 ------
9>Linking...
9>ndbsched_mt.lib(mt.obj) : error LNK2019: unresolved external symbol __ReadWriteBarrier referenced in function "void __cdecl unlock(struct thr_spin_lock *)" (?unlock@@YAXPAUthr_spin_lock@@@Z)
9>ndbsched_mt.lib(mt.obj) : error LNK2019: unresolved external symbol __ReadBarrier referenced in function "unsigned int __cdecl link_thread_send_buffers(struct thr_repository::send_buffer *,unsigned int)" (?link_thread_send_buffers@@YAIPAUsend_buffer@thr_repository@@I@Z)
9>ndbsched_mt.lib(mt.obj) : error LNK2019: unresolved external symbol __WriteBarrier referenced in function "void __cdecl flush_send_buffer(struct thr_data *,unsigned int)" (?flush_send_buffer@@YAXPAUthr_data@@I@Z)
9>C:\repo\cmake-rebuild-47929\storage\ndb\src\kernel\Debug\ndbmtd.exe : fatal error LNK1120: 3 unresolved externals
9>Build log was saved at "file://c:\repo\cmake-rebuild-47929\storage\ndb\src\kernel\ndbmtd.dir\Debug\BuildLog.htm"
9>ndbmtd - 4 error(s), 0 warning(s)

How to repeat:
devenv /build Debug MySql.sln

Suggested fix:
intrinsics are only linked with /Oi which is not set in /D_DEBUG

=== modified file 'storage/ndb/src/kernel/vm/mt-asm.h'
--- storage/ndb/src/kernel/vm/mt-asm.h  2009-12-23 12:03:35 +0000
+++ storage/ndb/src/kernel/vm/mt-asm.h  2010-02-10 06:17:56 +0000
@@ -159,9 +159,15 @@
  * Microsoft
  *******************/
 // Using instrinsics available on all architectures
+#ifndef _DEBUG
 #define mb()    _ReadWriteBarrier()
 #define rmb()   _ReadBarrier()
 #define wmb()   _WriteBarrier()
+#else
+#define mb()    do {} while(0)
+#define rmb()   do {} while(0)
+#define wmb()   do {} while(0)
+#endif
 #define read_barrier_depends()  do {} while(0)

 #define NDB_HAVE_XCNG
[10 Feb 2010 7:09] jack andrews
see patch in 'Suggested Fix'
[10 Feb 2010 9:33] Magnus BlÄudd
Please explain why that would work.
[10 Feb 2010 9:46] jack andrews
in docs for _ReadWriteBarrier(void):

  "Effectively blocks an optimization of reads and writes to global memory."

in _DEBUG, optimization is off.

these intrinsics only link when flagged by /Oi
[17 Feb 2010 6:16] jack andrews
can we push the patch so the branch will compile in "Debug"
  or
can you revert the patch that caused the problem initially?
[23 Feb 2010 9:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/101159

3409 Jack Andrews	2010-02-23
      Bug #51048  	intrinsics in ndbmt don't link with /DEBUG
      
         . this affects the barrier code on windows
      
         . first, it defines mb() as MemoryBarrier() in /both/
           debug and optimized mode (because it has to do with
           forcing the CPU to complete read/writes).
      
         . _{Read,Write}Barrier used only in optimized mode.
           these force the compiler to block optimizations
           so r/w operations will complete before a barrier
[24 Feb 2010 13:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/101321

3410 Jack Andrews	2010-02-25 [merge]
      merge for bug #51048
[24 Feb 2010 13:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/101322

3411 Jack Andrews	2010-02-25 [merge]
      second merge for bug #51048
[24 Feb 2010 13:40] Bugs System
Pushed into 5.1.41-ndb-7.0.13 (revid:jack@sun.com-20100224133919-hp6bixbip1t32sgr) (version source revid:jack@sun.com-20100224133919-hp6bixbip1t32sgr) (merge vers: 5.1.41-ndb-7.0.13) (pib:16)
[24 Feb 2010 14:31] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/101329

3407 Martin Skold	2010-02-24 [merge]
      Merge
      added:
        storage/ndb/cmake/
        storage/ndb/cmake/cmake_parse_arguments.cmake
        storage/ndb/cmake/libutils.cmake
      modified:
        .bzrignore
        mysql-test/suite/ndb/r/ndb_dd_alter.result
        mysql-test/suite/ndb/r/ndb_dd_restore_compat.result
        mysql-test/suite/ndb/t/show_attributes.inc
        storage/ndb/CMakeLists.txt
        storage/ndb/Makefile.am
        storage/ndb/config/type_ndbapitools.cmake
        storage/ndb/include/kernel/GlobalSignalNumbers.h
        storage/ndb/include/util/Parser.hpp
        storage/ndb/src/CMakeLists.txt
        storage/ndb/src/kernel/blocks/CMakeLists.txt
        storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
        storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp
        storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
        storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
        storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
        storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
        storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
        storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
        storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
        storage/ndb/src/kernel/blocks/suma/Suma.cpp
        storage/ndb/src/kernel/blocks/suma/Suma.hpp
        storage/ndb/src/kernel/blocks/suma/SumaInit.cpp
        storage/ndb/src/kernel/vm/ArrayPool.hpp
        storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp
        storage/ndb/src/mgmsrv/CMakeLists.txt
        storage/ndb/src/mgmsrv/MgmtSrvr.cpp
        storage/ndb/src/mgmsrv/MgmtSrvr.hpp
        storage/ndb/src/mgmsrv/Services.cpp
        storage/ndb/src/ndbapi/NdbDictionary.cpp
        storage/ndb/test/include/HugoTransactions.hpp
        storage/ndb/test/include/NdbRestarter.hpp
        storage/ndb/test/ndbapi/testMgm.cpp
        storage/ndb/test/ndbapi/testUpgrade.cpp
        storage/ndb/test/run-test/command.cpp
        storage/ndb/test/run-test/db.cpp
        storage/ndb/test/run-test/upgrade-tests.txt
        storage/ndb/test/src/CpcClient.cpp
        storage/ndb/test/src/HugoTransactions.cpp
        storage/ndb/test/src/NdbRestarter.cpp
        storage/ndb/tools/CMakeLists.txt
        storage/ndb/tools/desc.cpp
[24 Feb 2010 16:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/101348

3433 Martin Skold	2010-02-24 [merge]
      Merge
      added:
        mysql-test/extra/rpl_tests/check_type.inc
        mysql-test/extra/rpl_tests/type_conversions.test
        mysql-test/suite/rpl/r/rpl_typeconv.result
        mysql-test/suite/rpl/r/rpl_typeconv_innodb.result
        mysql-test/suite/rpl/t/rpl_typeconv-slave.opt
        mysql-test/suite/rpl/t/rpl_typeconv.test
        mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
        mysql-test/suite/rpl_ndb/r/rpl_ndb_typeconv_all.result
        mysql-test/suite/rpl_ndb/r/rpl_ndb_typeconv_lossy.result
        mysql-test/suite/rpl_ndb/r/rpl_ndb_typeconv_nonlossy.result
        mysql-test/suite/rpl_ndb/r/rpl_ndb_typeconv_strict.result
        mysql-test/suite/rpl_ndb/t/rpl_ndb_typeconv_all.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_typeconv_lossy.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_typeconv_nonlossy.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_typeconv_strict.test
      modified:
        .bzrignore
        client/Makefile.am
        client/mysqlbinlog.cc
        libmysqld/Makefile.am
        mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
        mysql-test/extra/rpl_tests/rpl_row_basic.test
        mysql-test/r/mysqlbinlog_row_innodb.result
        mysql-test/r/mysqlbinlog_row_myisam.result
        mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result
        mysql-test/suite/rpl/r/rpl_bug31076.result
        mysql-test/suite/rpl/r/rpl_colSize.result
        mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
        mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
        mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
        mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
        mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
        mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
        mysql-test/suite/rpl/r/rpl_row_colSize.result
        mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
        mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
        mysql-test/suite/rpl/t/rpl_bug31076.test
        mysql-test/suite/rpl/t/rpl_colSize.test
        mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
        mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
        mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
        sql/field.cc
        sql/field.h
        sql/log.cc
        sql/log_event.cc
        sql/log_event.h
        sql/log_event_old.cc
        sql/mysql_priv.h
        sql/mysqld.cc
        sql/rpl_record.cc
        sql/rpl_rli.h
        sql/rpl_utility.cc
        sql/rpl_utility.h
        sql/set_var.cc
        sql/set_var.h
        sql/share/errmsg.txt
        sql/sql_class.h
        sql/sql_select.cc
        storage/ndb/CMakeLists.txt
[25 Feb 2010 1:26] jack andrews
no docs required - an internal matter
[25 Feb 2010 14:28] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[25 Feb 2010 14:28] Jon Stephens
Closed without further action per developer comment above.