1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
Forwarded: https://github.com/facebook/rocksdb/pull/6992
# Merged in RocksDB 6.13.fb, but not updated into MariaDB 10.6
Forwarded: 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);
}
|