Bug #80069 ndb test programs pthread compilation failure
Submitted: 20 Jan 2016 11:14 Modified: 27 Jan 2016 14:58
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.5.1 OS:Any
Assigned to: CPU Architecture:Any

[20 Jan 2016 11:14] Magnus Blåudd
Description:
The NDB specific test programs fails to compile on Windows in 7.5. 

This seems to be caused by recent changes in the pthread emulation functions provided by MySQL Server. With MySQL Server 5.6 we programmed against pthread_ prefixed functions but when switching to MySQL Server 5.7 you have to program against native_ prefixed functions. This change often pas through undetected since when merging 7.4 -> 7.5 the same compilation failure does not occur on Linux since there pthread.h is included and the the error goes undetected. 

How to repeat:
Compile MySQL Cluster with the cmake parameter WITH_NDB_TEST=1 using VS2013 

Error	2	error C2065: 'pthread_t' : undeclared identifier	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testblobs.cpp	4754	1	testBlobs
Error	3	error C2146: syntax error : missing ';' before identifier 'thread_handle'	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testblobs.cpp	4754	1	testBlobs
Error	4	error C2065: 'thread_handle' : undeclared identifier	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testblobs.cpp	4754	1	testBlobs
Error	5	error C2065: 'thread_handle' : undeclared identifier	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testblobs.cpp	4755	1	testBlobs
Error	6	error C3861: 'pthread_create': identifier not found	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testblobs.cpp	4755	1	testBlobs
Error	7	error C2065: 'thread_handle' : undeclared identifier	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testblobs.cpp	4862	1	testBlobs
Error	8	error C3861: 'pthread_join': identifier not found	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testblobs.cpp	4862	1	testBlobs
Error	15	error C2146: syntax error : missing ';' before identifier 'm_id'	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5101	1	testOIBasic
Error	16	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5101	1	testOIBasic
Error	17	error C2039: 'm_id' : is not a member of 'Thr'	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5178	1	testOIBasic
Error	18	error C3861: 'pthread_self': identifier not found	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5178	1	testOIBasic
Error	19	error C2065: 'pthread_t' : undeclared identifier	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5260	1	testOIBasic
Error	20	error C2146: syntax error : missing ';' before identifier 'id'	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5260	1	testOIBasic
Error	21	error C2065: 'id' : undeclared identifier	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5260	1	testOIBasic
Error	22	error C3861: 'pthread_self': identifier not found	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5260	1	testOIBasic
Error	23	error C2039: 'm_id' : is not a member of 'Thr'	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5264	1	testOIBasic
Error	24	error C2065: 'id' : undeclared identifier	d:\ade\mysql\7.5\storage\ndb\test\ndbapi\testoibasic.cpp	5264	1	testOIBasic
Error	25	error C3861: 'pthread_equal': identifier not found	d:\ade\mysql\7.5\storage\ndb\test\ndbapi

Suggested fix:
There are two different ways to fix this.

1) Consider if the test programs could use the portability layer functions provided by NDB instead. Doing that would mean less problems in the long run. If such change is possible, we can fix the problem in 7.4

2) In case solution 1) is not possible to implement we simply rename pthread_ prefixed functions to use native_ prefixed functions as provided by include/my_thread.h 

Prefer solution 1) as that would be better in long rnu to isolate the NDb parts of MySQL Cluster from changes in upper layers of MySQL Server
[27 Jan 2016 15:00] Jon Stephens
Fixed in NDB 7.5.1.

Testing only--no end user changes to document.

Closed.