Skip to content

Commit ab0e503

Browse files
committed
MDEV-11195: Correct enablement of NUMA in innodb/xtradb
No -DHAVE_LIBNUMA=1 was passed to the source compile (and the global include/my_config.h wasn't used). This also is Linux only so corrected the cmake macro. Fixed indenting in cmake macro. Removed NUMA defination from include/my_config.h as its only in the storage engine. Thanks Elena Stepanova and Vladislav Vaintroub for the detailed list of bugs/questions. Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
1 parent 71e11bc commit ab0e503

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ INCLUDE(install_macros)
162162
INCLUDE(systemd)
163163
INCLUDE(mysql_add_executable)
164164
INCLUDE(crc32-vpmsum)
165-
INCLUDE(numa)
166165

167166
# Handle options
168167
OPTION(DISABLE_SHARED

cmake/numa.cmake

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
MACRO (MYSQL_CHECK_NUMA)
22

3+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
34
CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H)
45
CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H)
56

@@ -10,29 +11,35 @@ MACRO (MYSQL_CHECK_NUMA)
1011
ENDIF()
1112

1213
IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H)
13-
SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
14-
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa)
15-
CHECK_C_SOURCE_COMPILES(
16-
"
17-
#include <numa.h>
18-
#include <numaif.h>
19-
int main()
20-
{
21-
struct bitmask *all_nodes= numa_all_nodes_ptr;
22-
set_mempolicy(MPOL_DEFAULT, 0, 0);
23-
return all_nodes != NULL;
24-
}"
25-
HAVE_LIBNUMA)
26-
SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
14+
SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
15+
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa)
16+
CHECK_C_SOURCE_COMPILES(
17+
"
18+
#include <numa.h>
19+
#include <numaif.h>
20+
int main()
21+
{
22+
struct bitmask *all_nodes= numa_all_nodes_ptr;
23+
set_mempolicy(MPOL_DEFAULT, 0, 0);
24+
return all_nodes != NULL;
25+
}"
26+
HAVE_LIBNUMA)
27+
SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
28+
IF(HAVE_LIBNUMA)
29+
ADD_DEFINITIONS(-DHAVE_LIBNUMA=1)
30+
ENDIF()
2731
ELSE()
28-
SET(HAVE_LIBNUMA 0)
32+
SET(HAVE_LIBNUMA 0)
2933
ENDIF()
3034

3135
IF(WITH_NUMA AND NOT HAVE_LIBNUMA)
3236
# Forget it in cache, abort the build.
3337
UNSET(WITH_NUMA CACHE)
3438
MESSAGE(FATAL_ERROR "Could not find numa headers/libraries")
3539
ENDIF()
40+
ELSE()
41+
SET(HAVE_LIBNUMA 0)
42+
ENDIF()
3643

3744
ENDMACRO()
3845

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106
#cmakedefine HAVE_LIBWRAP 1
107107
#cmakedefine HAVE_SYSTEMD 1
108108
#cmakedefine HAVE_CRC32_VPMSUM 1
109-
#cmakedefine HAVE_LIBNUMA 1
110109

111110
/* Does "struct timespec" have a "sec" and "nsec" field? */
112111
#cmakedefine HAVE_TIMESPEC_TS_SEC 1

storage/innobase/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ INCLUDE(lzo)
2424
INCLUDE(lzma)
2525
INCLUDE(bzip2)
2626
INCLUDE(snappy)
27+
INCLUDE(numa)
2728

2829
MYSQL_CHECK_LZ4()
2930
MYSQL_CHECK_LZO()

storage/xtradb/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ INCLUDE(lzo)
2323
INCLUDE(lzma)
2424
INCLUDE(bzip2)
2525
INCLUDE(snappy)
26+
INCLUDE(numa)
2627

2728
MYSQL_CHECK_LZ4()
2829
MYSQL_CHECK_LZO()

0 commit comments

Comments
 (0)