rocksdb: Upgrade to 7.5.3 release

Drop upstreamed patches and forward port existing ones

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2022-09-11 10:46:23 -07:00
parent 4616783204
commit 514610e78d
9 changed files with 13 additions and 135 deletions

View File

@ -27,7 +27,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -935,7 +935,12 @@ endif()
@@ -1000,7 +1000,12 @@ option(ROCKSDB_BUILD_SHARED "Build share
if(WIN32)
set(SYSTEM_LIBS ${SYSTEM_LIBS} shlwapi.lib rpcrt4.lib)
else()
@ -39,7 +39,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
+ endif()
endif()
add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES} ${BUILD_VERSION_CC})
set(ROCKSDB_PLUGIN_EXTERNS "")
--- /dev/null
+++ b/cmake/modules/CheckAtomic.cmake
@@ -0,0 +1,69 @@

View File

@ -13,16 +13,7 @@ Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/7541]
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@
# 3. cmake ..
# 4. make -j
-cmake_minimum_required(VERSION 3.5.1)
+cmake_minimum_required(VERSION 3.7.2)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/")
include(ReadVersion)
@@ -152,12 +152,7 @@ else()
@@ -153,12 +153,7 @@ else()
if(WITH_BZ2)
find_package(BZip2 REQUIRED)
add_definitions(-DBZIP2)

View File

@ -1,42 +0,0 @@
From ddcc8a9f7e0f0bfee96f2f0a0c10f21f9fa9b05d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 15 Nov 2020 15:02:28 -0800
Subject: [PATCH] folly: Use SYS_futex for syscall
glibc defines SYS_futex and on newer 32bit CPUs like RISCV-32, arc there
is no 32bit time_t therefore define SYS_futex in terms of SYS_futex_time64
Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/7676]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
third-party/folly/folly/detail/Futex.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- a/third-party/folly/folly/detail/Futex.cpp
+++ b/third-party/folly/folly/detail/Futex.cpp
@@ -48,9 +48,15 @@ namespace {
#define FUTEX_CLOCK_REALTIME 256
#endif
+/// Newer 32bit CPUs eg. RISCV-32 are defaulting to 64bit time_t from get go and
+/// therefore do not define __NR_futex
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+# define SYS_futex SYS_futex_time64
+#endif
+
int nativeFutexWake(const void* addr, int count, uint32_t wakeMask) {
long rv = syscall(
- __NR_futex,
+ SYS_futex,
addr, /* addr1 */
FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG, /* op */
count, /* val */
@@ -112,7 +118,7 @@ FutexResult nativeFutexWaitImpl(
// Unlike FUTEX_WAIT, FUTEX_WAIT_BITSET requires an absolute timeout
// value - http://locklessinc.com/articles/futex_cheat_sheet/
long rv = syscall(
- __NR_futex,
+ SYS_futex,
addr, /* addr1 */
op, /* op */
expected, /* val */

View File

@ -1,23 +0,0 @@
From 1a69d4cc3f97e348dba9714c7ec60da1a8650664 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 15 Jun 2021 22:05:36 -0700
Subject: [PATCH] jemalloc_helper: Limit the mm_malloc.h hack to glibc on linux
Musl does not need this hack
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
port/jemalloc_helper.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/port/jemalloc_helper.h
+++ b/port/jemalloc_helper.h
@@ -5,7 +5,7 @@
#pragma once
-#if defined(__clang__)
+#if defined(__clang__) && defined(__GLIBC__)
// glibc's `posix_memalign()` declaration specifies `throw()` while clang's
// declaration does not. There is a hack in clang to make its re-declaration
// compatible with glibc's if they are declared consecutively. That hack breaks

View File

@ -1,44 +0,0 @@
From 89c032a9b4011385c0b504ea61e5df0db71f0ff5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 16 Jun 2021 19:06:02 -0700
Subject: [PATCH] range_tree: Implement toku_time_now for rv32/rv64 in asm
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../range_tree/lib/portability/toku_time.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
index 4425a4a2e..4ac964f85 100644
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -133,6 +133,25 @@ static inline tokutime_t toku_time_now(void) {
return result;
#elif defined(__powerpc__)
return __ppc_get_timebase();
+#elif defined(__riscv) // RISC-V
+#if __riscv_xlen == 32
+ uint32_t lo, hi0, hi1;
+ __asm __volatile__(
+ "rdcycleh %0\n"
+ "rdcycle %1\n"
+ "rdcycleh %2\n"
+ "sub %0, %0, %2\n"
+ "seqz %0, %0\n"
+ "sub %0, zero, %0\n"
+ "and %1, %1, %0\n"
+ : "=r"(hi0), "=r"(lo), "=r"(hi1));
+ return ((uint64_t)hi1 << 32) | lo;
+#else
+ uint64_t result;
+ __asm __volatile__("rdcycle %0" : "=r"(result));
+ return result;
+#endif
+
#else
#error No timer implementation for this platform
#endif
--
2.32.0

View File

@ -3,7 +3,7 @@ implement timer for arm >= v6
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -161,6 +161,20 @@ static inline tokutime_t toku_time_now(v
@@ -164,6 +164,20 @@ static inline tokutime_t toku_time_now(v
struct timeval tv;
gettimeofday(&tv, nullptr);
return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec;

View File

@ -3,11 +3,10 @@ implement timer implementation for mips platform
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -155,7 +155,12 @@ static inline tokutime_t toku_time_now(v
__asm __volatile__("rdcycle %0" : "=r"(result));
return result;
#endif
-
@@ -158,6 +158,12 @@ static inline tokutime_t toku_time_now(v
uint64_t cycles;
asm volatile("rdcycle %0" : "=r"(cycles));
return cycles;
+#elif defined(__mips__)
+ // mips apparently only allows rdtsc for superusers, so we fall
+ // back to gettimeofday. It's possible clock_gettime would be better.

View File

@ -23,6 +23,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
+ uint64_t result;
+ asm volatile("mfspr %0, 268" : "=r"(result));
+ return result;
#elif defined(__riscv) // RISC-V
#if __riscv_xlen == 32
uint32_t lo, hi0, hi1;
#elif defined(__s390x__)
uint64_t result;
asm volatile("stckf %0" : "=Q"(result) : : "cc");

View File

@ -6,15 +6,12 @@ LIC_FILES_CHKSUM = "file://LICENSE.Apache;md5=3b83ef96387f14655fc854ddc3c6bd57 \
file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://LICENSE.leveldb;md5=fb04ff57a14f308f2eed4a9b87d45837"
SRCREV = "8608d75d85f8e1b3b64b73a4fb6d19baec61ba5c"
SRCBRANCH = "6.20.fb"
SRCREV = "540d5aae516265170564ec27b3e67a54a11b7045"
SRCBRANCH = "7.5.fb"
SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH};protocol=https \
file://0001-cmake-Add-check-for-atomic-support.patch \
file://0001-cmake-Use-exported-target-for-bz2.patch \
file://0001-folly-Use-SYS_futex-for-syscall.patch \
file://0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch \
file://0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch \
file://ppc64.patch \
file://mips.patch \
file://arm.patch \