commit:     04ef58d781e50b4f676789e70899e761dbdcdd0f
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  9 21:41:49 2018 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Fri Feb  9 21:41:49 2018 +0000
URL:        https://gitweb.gentoo.org/proj/mysql-extras.git/commit/?id=04ef58d7

Add patch to enable NUMA in MariaDB 10.1

 20029_all_mariadb-10.1.31-enable-numa.patch | 209 ++++++++++++++++++++++++++++
 1 file changed, 209 insertions(+)

diff --git a/20029_all_mariadb-10.1.31-enable-numa.patch 
b/20029_all_mariadb-10.1.31-enable-numa.patch
new file mode 100644
index 0000000..41c8fa0
--- /dev/null
+++ b/20029_all_mariadb-10.1.31-enable-numa.patch
@@ -0,0 +1,209 @@
+Backport MariaDB 10.2 support into 10.1
+
+diff --git a/cmake/numa.cmake b/cmake/numa.cmake
+new file mode 100644
+index 000000000000..d5234a5ef4f6
+--- /dev/null
++++ b/cmake/numa.cmake
+@@ -0,0 +1,43 @@
++MACRO (MYSQL_CHECK_NUMA)
++
++  IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
++    CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H)
++    CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H)
++
++    IF(HAVE_NUMA_H AND HAVE_NUMAIF_H)
++      OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON)
++    ELSE()
++      OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF)
++    ENDIF()
++
++    IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H)
++      SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
++      SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa)
++      CHECK_C_SOURCE_COMPILES(
++      "
++      #include <numa.h>
++      #include <numaif.h>
++      int main()
++      {
++         struct bitmask *all_nodes= numa_all_nodes_ptr;
++         set_mempolicy(MPOL_DEFAULT, 0, 0);
++         return all_nodes != NULL;
++      }"
++      HAVE_LIBNUMA)
++      SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
++      IF(HAVE_LIBNUMA)
++        ADD_DEFINITIONS(-DHAVE_LIBNUMA=1)
++        SET(NUMA_LIBRARY "numa")
++      ENDIF()
++    ENDIF()
++
++    IF(WITH_NUMA AND NOT HAVE_LIBNUMA)
++      # Forget it in cache, abort the build.
++      UNSET(WITH_NUMA CACHE)
++      UNSET(NUMA_LIBRARY CACHE)
++      MESSAGE(FATAL_ERROR "Could not find numa headers/libraries")
++    ENDIF()
++  ENDIF()
++
++ENDMACRO()
++
+diff --git 
a/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt 
b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt
+new file mode 100644
+index 000000000000..c1c2bb26b8ac
+--- /dev/null
++++ b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt
+@@ -0,0 +1,1 @@
++--loose-innodb_numa_interleave=1
+diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
+index 7e667d5ebb29..c80ef6f09937 100644
+--- a/storage/innobase/CMakeLists.txt
++++ b/storage/innobase/CMakeLists.txt
+@@ -23,12 +23,14 @@ INCLUDE(lzo)
+ INCLUDE(lzma)
+ INCLUDE(bzip2)
+ INCLUDE(snappy)
++INCLUDE(numa)
+ 
+ MYSQL_CHECK_LZ4()
+ MYSQL_CHECK_LZO()
+ MYSQL_CHECK_LZMA()
+ MYSQL_CHECK_BZIP2()
+ MYSQL_CHECK_SNAPPY()
++MYSQL_CHECK_NUMA()
+ 
+ IF(CMAKE_CROSSCOMPILING)
+   # Use CHECK_C_SOURCE_COMPILES instead of CHECK_C_SOURCE_RUNS when
+@@ -63,5 +63,2 @@
+     ENDIF()
+     ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
+-    IF(HAVE_LIBNUMA)
+-      LINK_LIBRARIES(numa)
+-    ENDIF()
+@@ -517,6 +517,10 @@
+ MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
+   MODULE_ONLY
+   MODULE_OUTPUT_NAME ha_innodb
+-  LINK_LIBRARIES ${ZLIB_LIBRARY} ${LIBSYSTEMD} ${LINKER_SCRIPT})
++  LINK_LIBRARIES
++        ${ZLIB_LIBRARY}
++        ${NUMA_LIBRARY}
++        ${LIBSYSTEMD}
++        ${LINKER_SCRIPT})
+ 
+ ADD_DEPENDENCIES(innobase GenError)
+diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
+index 7d2a3fad56dc..51e24b3cd8a2 100644
+--- a/storage/xtradb/CMakeLists.txt
++++ b/storage/xtradb/CMakeLists.txt
+@@ -23,12 +23,14 @@ INCLUDE(lzo)
+ INCLUDE(lzma)
+ INCLUDE(bzip2)
+ INCLUDE(snappy)
++INCLUDE(numa)
+ 
+ MYSQL_CHECK_LZ4()
+ MYSQL_CHECK_LZO()
+ MYSQL_CHECK_LZMA()
+ MYSQL_CHECK_BZIP2()
+ MYSQL_CHECK_SNAPPY()
++MYSQL_CHECK_NUMA()
+ 
+ IF(CMAKE_CROSSCOMPILING)
+   # Use CHECK_C_SOURCE_COMPILES instead of CHECK_C_SOURCE_RUNS when
+@@ -63,5 +63,2 @@
+     ENDIF()
+     ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
+-    IF(HAVE_LIBNUMA)
+-      LINK_LIBRARIES(numa)
+-    ENDIF()
+@@ -507,6 +507,9 @@
+ MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
+   DEFAULT RECOMPILE_FOR_EMBEDDED
+-  LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT})
++  LINK_LIBRARIES
++    ${ZLIB_LIBRARY}
++    ${NUMA_LIBRARY}
++    ${LINKER_SCRIPT})
+ 
+ IF(TARGET xtradb AND NOT XTRADB_OK)
+   MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform")
+diff --git a/mysql-test/include/have_numa.inc 
b/mysql-test/include/have_numa.inc
+new file mode 100644
+index 000000000000..18bca99e04d7
+--- /dev/null
++++ b/mysql-test/include/have_numa.inc
+@@ -0,0 +1,9 @@
++let $numa_support = `SELECT COUNT(VARIABLE_VALUE) = 1 FROM
++  INFORMATION_SCHEMA.GLOBAL_VARIABLES
++  WHERE VARIABLE_NAME='innodb_numa_interleave'`;
++
++if ( $numa_support == 0 )
++{
++    --skip Test requires: Binary must be built with NUMA support.
++}
++
+diff --git a/mysql-test/suite/sys_vars/r/innodb_numa_interleave_basic.result 
b/mysql-test/suite/sys_vars/r/innodb_numa_interleave_basic.result
+new file mode 100644
+index 000000000000..21ed16c1dab8
+--- /dev/null
++++ b/mysql-test/suite/sys_vars/r/innodb_numa_interleave_basic.result
+@@ -0,0 +1,11 @@
++call mtr.add_suppression("InnoDB: Failed to set NUMA memory policy");
++SELECT @@GLOBAL.innodb_numa_interleave;
++@@GLOBAL.innodb_numa_interleave
++1
++SET @@GLOBAL.innodb_numa_interleave=off;
++ERROR HY000: Variable 'innodb_numa_interleave' is a read only variable
++SELECT @@GLOBAL.innodb_numa_interleave;
++@@GLOBAL.innodb_numa_interleave
++1
++SELECT @@SESSION.innodb_numa_interleave;
++ERROR HY000: Variable 'innodb_numa_interleave' is a GLOBAL variable
+diff --git a/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test 
b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test
+new file mode 100644
+index 000000000000..518b5ebba177
+--- /dev/null
++++ b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test
+@@ -0,0 +1,15 @@
++--source include/have_innodb.inc
++--source include/have_numa.inc
++
++call mtr.add_suppression("InnoDB: Failed to set NUMA memory policy");
++
++SELECT @@GLOBAL.innodb_numa_interleave;
++
++--error ER_INCORRECT_GLOBAL_LOCAL_VAR
++SET @@GLOBAL.innodb_numa_interleave=off;
++
++SELECT @@GLOBAL.innodb_numa_interleave;
++
++--error ER_INCORRECT_GLOBAL_LOCAL_VAR
++SELECT @@SESSION.innodb_numa_interleave;
++
+diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result 
b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+index 87e000faf025..ad6dcc1bb643 100644
+--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
++++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+@@ -2,6 +2,7 @@ select * from information_schema.system_variables
+ where variable_name like 'innodb%' and
+ variable_name not in (
+ 'innodb_disallow_writes',           # only available WITH_WSREP
++'innodb_numa_interleave',           # only available WITH_NUMA
+ 'innodb_sched_priority_cleaner',    # linux only
+ 'innodb_use_native_aio')            # default value depends on OS
+ order by variable_name;
+diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test 
b/mysql-test/suite/sys_vars/t/sysvars_innodb.test
+index bd8442b6a443..38f248cb6113 100644
+--- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test
++++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test
+@@ -9,6 +9,7 @@ select * from information_schema.system_variables
+   where variable_name like 'innodb%' and
+   variable_name not in (
+     'innodb_disallow_writes',           # only available WITH_WSREP
++    'innodb_numa_interleave',           # only available WITH_NUMA
+     'innodb_sched_priority_cleaner',    # linux only
+     'innodb_use_native_aio')            # default value depends on OS
+   order by variable_name;
+

Reply via email to