MDEV-32791 MariaDB cannot be installed on Red Hat ubi9

The libpmem dependency that had been added in
commit 3daef523af (MDEV-17084)
did not achieve any measurable performance improvement when
comparing the same PMEM device with and without "mount -o dax"
using the Linux ext4 file system.

Because Red Hat has deprecated libpmem, let us remove the code
altogether.

Note: This is a 10.6 version of
commit 3f9f5ca48e
which will retain PMEM support in MariaDB Server 10.11.
This commit is contained in:
Marko Mäkelä 2024-04-19 11:04:51 +03:00
parent bb2e125d07
commit 8e663f5e90
6 changed files with 0 additions and 170 deletions

View file

@ -1,18 +0,0 @@
if(PMEM_LIBRARIES)
set(PMEM_FOUND TRUE)
return()
endif()
if(DEFINED PMEM_LIBRARIES)
set(PMEM_FOUND FALSE)
return()
endif()
find_path(PMEM_INCLUDE_DIR NAMES libpmem.h)
find_library(PMEM_LIBRARIES NAMES pmem)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
PMEM DEFAULT_MSG
PMEM_LIBRARIES PMEM_INCLUDE_DIR)
mark_as_advanced(PMEM_INCLUDE_DIR PMEM_LIBRARIES)

View file

@ -61,12 +61,6 @@ replace_uring_with_aio()
-e '/-DWITH_URING=ON/d' -i debian/rules
}
disable_pmem()
{
sed '/libpmem-dev/d' -i debian/control
sed '/-DWITH_PMEM=ON/d' -i debian/rules
}
architecture=$(dpkg-architecture -q DEB_BUILD_ARCH)
# Parse release name and number from Linux standard base release
@ -99,18 +93,10 @@ in
# Debian
"buster")
replace_uring_with_aio
if [ ! "$architecture" = amd64 ]
then
disable_pmem
fi
;&
"bullseye"|"bookworm")
# mariadb-plugin-rocksdb in control is 4 arches covered by the distro rocksdb-tools
# so no removal is necessary.
if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]]
then
disable_pmem
fi
if [[ ! "$architecture" =~ amd64|arm64|armel|armhf|i386|mips64el|mipsel|ppc64el|s390x ]]
then
replace_uring_with_aio
@ -132,10 +118,6 @@ in
then
remove_rocksdb_tools
fi
if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]]
then
disable_pmem
fi
if [[ ! "$architecture" =~ amd64|arm64|armhf|ppc64el|s390x ]]
then
replace_uring_with_aio

1
debian/control vendored
View file

@ -30,7 +30,6 @@ Build-Depends: bison,
libnuma-dev [linux-any],
libpam0g-dev,
libpcre2-dev,
libpmem-dev [amd64 arm64 ppc64el riscv64],
libsnappy-dev,
libssl-dev,
libssl-dev:native,

6
debian/rules vendored
View file

@ -49,12 +49,6 @@ ifeq (32,$(DEB_HOST_ARCH_BITS))
CMAKEFLAGS += -DPLUGIN_ROCKSDB=NO
endif
# Only attempt to build with PMEM on archs that have package libpmem-dev available
# See https://packages.debian.org/search?searchon=names&keywords=libpmem-dev
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64 ppc64el riscv64))
CMAKEFLAGS += -DWITH_PMEM=ON
endif
# Add support for verbose builds
MAKEFLAGS += VERBOSE=1

View file

@ -439,24 +439,11 @@ SET(INNOBASE_SOURCES
ut/ut0vec.cc
ut/ut0wqueue.cc)
OPTION(WITH_PMEM "Support redo log in persistent memory" OFF)
FIND_PACKAGE(PMEM)
IF(PMEM_FOUND)
INCLUDE_DIRECTORIES(${PMEM_INCLUDES})
ADD_COMPILE_FLAGS(log/log0log.cc COMPILE_FLAGS "-DHAVE_PMEM")
SET(PMEM_LIBRARY ${PMEM_LIBRARIES})
ELSE()
IF(WITH_PMEM)
MESSAGE(FATAL_ERROR "WITH_PMEM=ON cannot be satisfied")
ENDIF()
ENDIF()
MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
MODULE_OUTPUT_NAME ha_innodb
DEFAULT RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES
${ZLIB_LIBRARY}
${PMEM_LIBRARY}
${NUMA_LIBRARY}
${LIBSYSTEMD}
${LINKER_SCRIPT})

View file

@ -295,125 +295,11 @@ dberr_t file_os_io::flush() noexcept
return os_file_flush(m_fd) ? DB_SUCCESS : DB_ERROR;
}
#ifdef HAVE_PMEM
#include <libpmem.h>
/** Memory mapped file */
class mapped_file_t
{
public:
mapped_file_t()= default;
mapped_file_t(const mapped_file_t &)= delete;
mapped_file_t &operator=(const mapped_file_t &)= delete;
mapped_file_t(mapped_file_t &&)= delete;
mapped_file_t &operator=(mapped_file_t &&)= delete;
~mapped_file_t() noexcept;
dberr_t map(const char *path, bool read_only= false,
bool nvme= false) noexcept;
dberr_t unmap() noexcept;
byte *data() noexcept { return m_area.data(); }
private:
span<byte> m_area;
};
mapped_file_t::~mapped_file_t() noexcept
{
if (!m_area.empty())
unmap();
}
dberr_t mapped_file_t::map(const char *path, bool read_only,
bool nvme) noexcept
{
auto fd= mysql_file_open(innodb_log_file_key, path,
read_only ? O_RDONLY : O_RDWR, MYF(MY_WME));
if (fd == -1)
return DB_ERROR;
const auto file_size= size_t{os_file_get_size(path).m_total_size};
const int nvme_flag= nvme ? MAP_SYNC : 0;
void *ptr=
my_mmap(0, file_size, read_only ? PROT_READ : PROT_READ | PROT_WRITE,
MAP_SHARED_VALIDATE | nvme_flag, fd, 0);
mysql_file_close(fd, MYF(MY_WME));
if (ptr == MAP_FAILED)
return DB_ERROR;
m_area= {static_cast<byte *>(ptr), file_size};
return DB_SUCCESS;
}
dberr_t mapped_file_t::unmap() noexcept
{
ut_ad(!m_area.empty());
if (my_munmap(m_area.data(), m_area.size()))
return DB_ERROR;
m_area= {};
return DB_SUCCESS;
}
static bool is_pmem(const char *path) noexcept
{
mapped_file_t mf;
return mf.map(path, true, true) == DB_SUCCESS ? true : false;
}
class file_pmem_io final : public file_io
{
public:
file_pmem_io() noexcept : file_io(true) {}
dberr_t open(const char *path, bool read_only) noexcept final
{
return m_file.map(path, read_only, true);
}
dberr_t rename(const char *old_path, const char *new_path) noexcept final
{
return os_file_rename(innodb_log_file_key, old_path, new_path) ? DB_SUCCESS
: DB_ERROR;
}
dberr_t close() noexcept final { return m_file.unmap(); }
__attribute__((warn_unused_result))
dberr_t read(os_offset_t offset, span<byte> buf) noexcept final
{
memcpy(buf.data(), m_file.data() + offset, buf.size());
return DB_SUCCESS;
}
dberr_t write(const char *, os_offset_t offset,
span<const byte> buf) noexcept final
{
pmem_memcpy_persist(m_file.data() + offset, buf.data(), buf.size());
return DB_SUCCESS;
}
dberr_t flush() noexcept final
{
ut_ad(0);
return DB_SUCCESS;
}
private:
mapped_file_t m_file;
};
#endif
dberr_t log_file_t::open(bool read_only) noexcept
{
ut_a(!is_opened());
#ifdef HAVE_PMEM
auto ptr= is_pmem(m_path.c_str())
? std::unique_ptr<file_io>(new file_pmem_io)
: std::unique_ptr<file_io>(new file_os_io);
#else
auto ptr= std::unique_ptr<file_io>(new file_os_io);
#endif
if (dberr_t err= ptr->open(m_path.c_str(), read_only))
return err;