mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 01:51:36 +02:00

This controls which linux implementation to use for
innodb_use_native_aio=ON.
innodb_linux_aio=auto is equivalent to innodb_linux_aio=io_uring when
it is available, and falling back to innodb_linux_aio=aio when not.
Debian packaging is no longer aio exclusive or uring, so
for those older Debian or Ubuntu releases, its a remove_uring directive.
For more recent releases, add mandatory liburing for consistent packaging.
WITH_LIBAIO is now an independent option from WITH_URING.
LINUX_NATIVE_AIO preprocessor constant is renamed to HAVE_LIBAIO,
analogous to existing HAVE_URING.
tpool::is_aio_supported(): A common feature check.
is_linux_native_aio_supported(): Remove. This had originally been added in
mysql/mysql-server@0da310b69d in 2012
to fix an issue where io_submit() on CentOS 5.5 would return EINVAL
for a /tmp/#sql*.ibd file associated with CREATE TEMPORARY TABLE.
But, starting with commit 2e814d4702
InnoDB
temporary tables will be written to innodb_temp_data_file_path.
The 2012 commit said that the error could occur on "old kernels".
Any GNU/Linux distribution that we currently support should be based
on a newer Linux kernel; for example, Red Hat Enterprise Linux 7
was released in 2014.
tpool::create_linux_aio(): Wraps the Linux implementations:
create_libaio() and create_liburing(), each defined in separate
compilation units (aio_linux.cc, aio_libaio.cc, aio_liburing.cc).
The CMake definitions are simplified using target_sources() and
target_compile_definitions(), all available since CMake 2.8.12.
With this change, there is no need to include ${CMAKE_SOURCE_DIR}/tpool
or add TPOOL_DEFINES flags anymore, target_link_libraries(lib tpool)
does all that.
This is joint work with Daniel Black and Vladislav Vaintroub.
57 lines
2 KiB
CMake
57 lines
2 KiB
CMake
ADD_LIBRARY(tpool STATIC
|
|
aio_simulated.cc
|
|
tpool_structs.h
|
|
CMakeLists.txt
|
|
tpool.h
|
|
tpool_generic.cc
|
|
task_group.cc
|
|
task.cc
|
|
wait_notification.cc
|
|
)
|
|
|
|
TARGET_INCLUDE_DIRECTORIES(tpool PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
IF(WIN32)
|
|
TARGET_SOURCES(tpool PRIVATE tpool_win.cc aio_win.cc)
|
|
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
TARGET_SOURCES(tpool PRIVATE aio_linux.cc)
|
|
OPTION(WITH_URING "Require that io_uring be used" OFF)
|
|
OPTION(WITH_LIBAIO "Require that libaio is used" OFF)
|
|
IF(WITH_URING)
|
|
SET(URING_REQUIRED REQUIRED)
|
|
ENDIF()
|
|
IF(WITH_LIBAIO)
|
|
SET(LIBAIO_REQUIRED REQUIRED)
|
|
ENDIF()
|
|
FIND_PACKAGE(URING QUIET ${URING_REQUIRED})
|
|
IF(URING_FOUND)
|
|
SET(URING_FOUND ${URING_FOUND} PARENT_SCOPE)
|
|
TARGET_COMPILE_DEFINITIONS(tpool PUBLIC "-DHAVE_URING")
|
|
TARGET_LINK_LIBRARIES(tpool PRIVATE ${URING_LIBRARIES})
|
|
TARGET_INCLUDE_DIRECTORIES(tpool PUBLIC ${URING_INCLUDE_DIRS})
|
|
TARGET_SOURCES(tpool PRIVATE aio_liburing.cc)
|
|
SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
|
|
SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
|
|
SET(CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIRS})
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${URING_LIBRARIES})
|
|
CHECK_SYMBOL_EXISTS(io_uring_mlock_size "liburing.h" HAVE_IO_URING_MLOCK_SIZE)
|
|
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
|
|
IF(HAVE_IO_URING_MLOCK_SIZE)
|
|
SET_SOURCE_FILES_PROPERTIES(aio_liburing.cc PROPERTIES COMPILE_FLAGS "-DHAVE_IO_URING_MLOCK_SIZE")
|
|
ENDIF()
|
|
ENDIF()
|
|
|
|
FIND_PACKAGE(LIBAIO QUIET ${LIBAIO_REQUIRED})
|
|
IF(LIBAIO_FOUND)
|
|
TARGET_COMPILE_DEFINITIONS(tpool PUBLIC "-DHAVE_LIBAIO")
|
|
TARGET_INCLUDE_DIRECTORIES(tpool PUBLIC ${LIBAIO_INCLUDE_DIRS})
|
|
TARGET_LINK_LIBRARIES(tpool PRIVATE ${LIBAIO_LIBRARIES})
|
|
TARGET_SOURCES(tpool PRIVATE aio_libaio.cc)
|
|
ENDIF()
|
|
ENDIF()
|
|
|
|
IF(URING_FOUND)
|
|
ADD_DEPENDENCIES(tpool GenError)
|
|
ENDIF()
|