summaryrefslogtreecommitdiffstats
path: root/debian/patches/rocksdb-kfreebsd.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/rocksdb-kfreebsd.patch')
-rw-r--r--debian/patches/rocksdb-kfreebsd.patch150
1 files changed, 150 insertions, 0 deletions
diff --git a/debian/patches/rocksdb-kfreebsd.patch b/debian/patches/rocksdb-kfreebsd.patch
new file mode 100644
index 00000000..da15484b
--- /dev/null
+++ b/debian/patches/rocksdb-kfreebsd.patch
@@ -0,0 +1,150 @@
+Forwarded: https://github.com/facebook/rocksdb/pull/6992
+From: Andrew Kryczka <andrewkr@fb.com>
+Date: Tue, 16 Jun 2020 19:34:21 -0700
+# Merged in RocksDB 6.13.fb, but not updated into MariaDB yet
+Bug: https://jira.mariadb.org/browse/MDEV-19251
+Description:
+ Upstream has merged this but we still need to wait for it to be included
+ in a RocksDB release and imported into MariaDB and then into Debian.
+--- a/storage/rocksdb/build_rocksdb.cmake
++++ b/storage/rocksdb/build_rocksdb.cmake
+@@ -90,6 +90,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ add_definitions(-DOS_LINUX)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ add_definitions(-DOS_SOLARIS)
++elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
++ add_definitions(-DOS_GNU_KFREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ add_definitions(-DOS_FREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+--- a/storage/rocksdb/rocksdb/CMakeLists.txt
++++ b/storage/rocksdb/rocksdb/CMakeLists.txt
+@@ -91,7 +91,7 @@ if(MSVC)
+ option(WITH_XPRESS "build with windows built in compression" OFF)
+ include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc)
+ else()
+- if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
++ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND NOT CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
+ # FreeBSD has jemalloc as default malloc
+ # but it does not have all the jemalloc files in include/...
+ set(WITH_JEMALLOC ON)
+@@ -413,6 +413,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ add_definitions(-DOS_LINUX)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ add_definitions(-DOS_SOLARIS)
++elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
++ add_definitions(-DOS_GNU_KFREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ add_definitions(-DOS_FREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+--- a/storage/rocksdb/rocksdb/build_tools/build_detect_platform
++++ b/storage/rocksdb/rocksdb/build_tools/build_detect_platform
+@@ -190,6 +190,17 @@ EOF
+ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread"
+ # PORT_FILES=port/freebsd/freebsd_specific.cc
+ ;;
++ GNU/kFreeBSD)
++ PLATFORM=OS_GNU_KFREEBSD
++ COMMON_FLAGS="$COMMON_FLAGS -DOS_GNU_KFREEBSD"
++ if [ -z "$USE_CLANG" ]; then
++ COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp"
++ else
++ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -latomic"
++ fi
++ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt"
++ # PORT_FILES=port/gnu_kfreebsd/gnu_kfreebsd_specific.cc
++ ;;
+ NetBSD)
+ PLATFORM=OS_NETBSD
+ COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_NETBSD"
+--- a/storage/rocksdb/rocksdb/env/env_posix.cc
++++ b/storage/rocksdb/rocksdb/env/env_posix.cc
+@@ -41,7 +41,7 @@
+ #include <time.h>
+ #include <algorithm>
+ // Get nano time includes
+-#if defined(OS_LINUX) || defined(OS_FREEBSD)
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD)
+ #elif defined(__MACH__)
+ #include <Availability.h>
+ #include <mach/clock.h>
+@@ -287,7 +287,8 @@ class PosixEnv : public CompositeEnvWrap
+ }
+
+ uint64_t NowNanos() override {
+-#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_AIX)
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || \
++ defined(OS_AIX)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return static_cast<uint64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
+@@ -307,8 +308,8 @@ class PosixEnv : public CompositeEnvWrap
+ }
+
+ uint64_t NowCPUNanos() override {
+-#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_AIX) || \
+- (defined(__MACH__) && defined(__MAC_10_12))
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || \
++ defined(OS_AIX) || (defined(__MACH__) && defined(__MAC_10_12))
+ struct timespec ts;
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
+ return static_cast<uint64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
+--- a/storage/rocksdb/rocksdb/port/stack_trace.cc
++++ b/storage/rocksdb/rocksdb/port/stack_trace.cc
+@@ -32,7 +32,7 @@ namespace port {
+
+ namespace {
+
+-#if defined(OS_LINUX) || defined(OS_FREEBSD)
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD)
+ const char* GetExecutableName() {
+ static char name[1024];
+
+--- a/storage/rocksdb/rdb_io_watchdog.h
++++ b/storage/rocksdb/rdb_io_watchdog.h
+@@ -56,19 +56,19 @@ class Rdb_io_watchdog {
+ int stop_timers() {
+ int ret = 0;
+
+- if (m_io_check_watchdog_timer) {
++ if (m_io_check_watchdog_timer != reinterpret_cast<timer_t>(-1)) {
+ ret = timer_delete(m_io_check_watchdog_timer);
+
+ if (!ret) {
+- m_io_check_watchdog_timer = nullptr;
++ m_io_check_watchdog_timer = reinterpret_cast<timer_t>(-1);
+ }
+ }
+
+- if (m_io_check_timer && !ret) {
++ if (m_io_check_timer != reinterpret_cast<timer_t>(-1) && !ret) {
+ ret = timer_delete(m_io_check_timer);
+
+ if (!ret) {
+- m_io_check_timer = nullptr;
++ m_io_check_timer = reinterpret_cast<timer_t>(-1);
+ }
+ }
+
+@@ -93,8 +93,8 @@ class Rdb_io_watchdog {
+
+ public:
+ explicit Rdb_io_watchdog(std::vector<std::string> &&directories)
+- : m_io_check_timer(nullptr),
+- m_io_check_watchdog_timer(nullptr),
++ : m_io_check_timer(reinterpret_cast<timer_t>(-1)),
++ m_io_check_watchdog_timer(reinterpret_cast<timer_t>(-1)),
+ m_io_in_progress(false),
+ m_dirs_to_check(std::move(directories)),
+ m_buf(nullptr) {
+--- a/storage/rocksdb/rdb_io_watchdog.cc
++++ b/storage/rocksdb/rdb_io_watchdog.cc
+@@ -111,7 +111,7 @@ void Rdb_io_watchdog::io_check_callback(
+ sql_print_warning("Deleting the watchdog I/O timer failed with %d.", errno);
+ }
+
+- m_io_check_watchdog_timer = nullptr;
++ m_io_check_watchdog_timer = reinterpret_cast<timer_t>(-1);
+
+ RDB_MUTEX_UNLOCK_CHECK(m_reset_mutex);
+ }