From 514610e78d8032f9161b0871bc0c5752f2471942 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 11 Sep 2022 10:46:23 -0700 Subject: rocksdb: Upgrade to 7.5.3 release Drop upstreamed patches and forward port existing ones Signed-off-by: Khem Raj --- .../0001-cmake-Add-check-for-atomic-support.patch | 4 +- .../0001-cmake-Use-exported-target-for-bz2.patch | 11 +--- .../0001-folly-Use-SYS_futex-for-syscall.patch | 42 ---------------- ...lper-Limit-the-mm_malloc.h-hack-to-glibc-.patch | 23 --------- ...Implement-toku_time_now-for-rv32-rv64-in-.patch | 44 ---------------- meta-oe/recipes-dbs/rocksdb/files/arm.patch | 2 +- meta-oe/recipes-dbs/rocksdb/files/mips.patch | 9 ++-- meta-oe/recipes-dbs/rocksdb/files/ppc64.patch | 6 +-- meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb | 58 ---------------------- meta-oe/recipes-dbs/rocksdb/rocksdb_7.5.3.bb | 55 ++++++++++++++++++++ 10 files changed, 66 insertions(+), 188 deletions(-) delete mode 100644 meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch delete mode 100644 meta-oe/recipes-dbs/rocksdb/files/0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch delete mode 100644 meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch delete mode 100644 meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb create mode 100644 meta-oe/recipes-dbs/rocksdb/rocksdb_7.5.3.bb diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch index 8bdd27ff25..2906100dee 100644 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch +++ b/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch @@ -27,7 +27,7 @@ Signed-off-by: Khem Raj --- 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 + 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 @@ diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch index d3054759a7..139312a298 100644 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch +++ b/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch @@ -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) diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch deleted file mode 100644 index 9c70d4f6a6..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ddcc8a9f7e0f0bfee96f2f0a0c10f21f9fa9b05d Mon Sep 17 00:00:00 2001 -From: Khem Raj -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 ---- - 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 */ diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch deleted file mode 100644 index dbb0dda221..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 1a69d4cc3f97e348dba9714c7ec60da1a8650664 Mon Sep 17 00:00:00 2001 -From: Khem Raj -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 ---- - 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 diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch deleted file mode 100644 index 86c1bffea6..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 89c032a9b4011385c0b504ea61e5df0db71f0ff5 Mon Sep 17 00:00:00 2001 -From: Khem Raj -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 ---- - .../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 - diff --git a/meta-oe/recipes-dbs/rocksdb/files/arm.patch b/meta-oe/recipes-dbs/rocksdb/files/arm.patch index d428a6624a..573767797d 100644 --- a/meta-oe/recipes-dbs/rocksdb/files/arm.patch +++ b/meta-oe/recipes-dbs/rocksdb/files/arm.patch @@ -3,7 +3,7 @@ implement timer for arm >= v6 Signed-off-by: Khem Raj --- 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; diff --git a/meta-oe/recipes-dbs/rocksdb/files/mips.patch b/meta-oe/recipes-dbs/rocksdb/files/mips.patch index db2305d296..0104d54347 100644 --- a/meta-oe/recipes-dbs/rocksdb/files/mips.patch +++ b/meta-oe/recipes-dbs/rocksdb/files/mips.patch @@ -3,11 +3,10 @@ implement timer implementation for mips platform Signed-off-by: Khem Raj --- 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. diff --git a/meta-oe/recipes-dbs/rocksdb/files/ppc64.patch b/meta-oe/recipes-dbs/rocksdb/files/ppc64.patch index bc40f1b1e7..45deef338c 100644 --- a/meta-oe/recipes-dbs/rocksdb/files/ppc64.patch +++ b/meta-oe/recipes-dbs/rocksdb/files/ppc64.patch @@ -23,6 +23,6 @@ Signed-off-by: Khem Raj + 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"); diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb deleted file mode 100644 index 2ad2d38a53..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb +++ /dev/null @@ -1,58 +0,0 @@ -SUMMARY = "RocksDB an embeddable, persistent key-value store" -DESCRIPTION = "RocksDB is library that provides an embeddable, persistent key-value store for fast storage." -HOMEPAGE = "http://rocksdb.org/" -LICENSE = "(Apache-2.0 | GPL-2.0-only) & BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE.Apache;md5=3b83ef96387f14655fc854ddc3c6bd57 \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://LICENSE.leveldb;md5=fb04ff57a14f308f2eed4a9b87d45837" - -SRCREV = "8608d75d85f8e1b3b64b73a4fb6d19baec61ba5c" -SRCBRANCH = "6.20.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 \ - " - -SRC_URI:append:riscv32 = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" -SRC_URI:append:mips = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" -SRC_URI:append:powerpc = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" -SRC_URI:remove:toolchain-clang:riscv32 = "file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" - -S = "${WORKDIR}/git" - -inherit cmake - -PACKAGECONFIG ??= "bzip2 zlib lz4 gflags" -PACKAGECONFIG[bzip2] = "-DWITH_BZ2=ON,-DWITH_BZ2=OFF,bzip2" -PACKAGECONFIG[lz4] = "-DWITH_LZ4=ON,-DWITH_LZ4=OFF,lz4" -PACKAGECONFIG[zlib] = "-DWITH_ZLIB=ON,-DWITH_ZLIB=OFF,zlib" -PACKAGECONFIG[zstd] = "-DWITH_ZSTD=ON,-DWITH_ZSTD=OFF,zstd" -PACKAGECONFIG[lite] = "-DROCKSDB_LITE=ON,-DROCKSDB_LITE=OFF" -PACKAGECONFIG[gflags] = "-DWITH_GFLAGS=ON,-DWITH_GFLAGS=OFF,gflags" - -# Tools and tests currently don't compile on armv5 so we disable them -EXTRA_OECMAKE = "\ - -DPORTABLE=ON \ - -DWITH_TESTS=OFF \ - -DWITH_BENCHMARK_TOOLS=OFF \ - -DWITH_TOOLS=OFF \ - -DFAIL_ON_WARNINGS=OFF \ -" - -do_install:append() { - # fix for qa check buildpaths - sed -i "s#${RECIPE_SYSROOT}##g" ${D}${libdir}/cmake/rocksdb/RocksDBTargets.cmake -} - -LDFLAGS:append:riscv64 = " -pthread" - -# Need toku_time_now() implemented for ppc/musl -# see utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h -COMPATIBLE_HOST:libc-musl:powerpc = "null" diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_7.5.3.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_7.5.3.bb new file mode 100644 index 0000000000..d4f0346ee1 --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_7.5.3.bb @@ -0,0 +1,55 @@ +SUMMARY = "RocksDB an embeddable, persistent key-value store" +DESCRIPTION = "RocksDB is library that provides an embeddable, persistent key-value store for fast storage." +HOMEPAGE = "http://rocksdb.org/" +LICENSE = "(Apache-2.0 | GPL-2.0-only) & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE.Apache;md5=3b83ef96387f14655fc854ddc3c6bd57 \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://LICENSE.leveldb;md5=fb04ff57a14f308f2eed4a9b87d45837" + +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://ppc64.patch \ + file://mips.patch \ + file://arm.patch \ + " + +SRC_URI:append:riscv32 = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" +SRC_URI:append:mips = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" +SRC_URI:append:powerpc = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" +SRC_URI:remove:toolchain-clang:riscv32 = "file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" + +S = "${WORKDIR}/git" + +inherit cmake + +PACKAGECONFIG ??= "bzip2 zlib lz4 gflags" +PACKAGECONFIG[bzip2] = "-DWITH_BZ2=ON,-DWITH_BZ2=OFF,bzip2" +PACKAGECONFIG[lz4] = "-DWITH_LZ4=ON,-DWITH_LZ4=OFF,lz4" +PACKAGECONFIG[zlib] = "-DWITH_ZLIB=ON,-DWITH_ZLIB=OFF,zlib" +PACKAGECONFIG[zstd] = "-DWITH_ZSTD=ON,-DWITH_ZSTD=OFF,zstd" +PACKAGECONFIG[lite] = "-DROCKSDB_LITE=ON,-DROCKSDB_LITE=OFF" +PACKAGECONFIG[gflags] = "-DWITH_GFLAGS=ON,-DWITH_GFLAGS=OFF,gflags" + +# Tools and tests currently don't compile on armv5 so we disable them +EXTRA_OECMAKE = "\ + -DPORTABLE=ON \ + -DWITH_TESTS=OFF \ + -DWITH_BENCHMARK_TOOLS=OFF \ + -DWITH_TOOLS=OFF \ + -DFAIL_ON_WARNINGS=OFF \ +" + +do_install:append() { + # fix for qa check buildpaths + sed -i "s#${RECIPE_SYSROOT}##g" ${D}${libdir}/cmake/rocksdb/RocksDBTargets.cmake +} + +LDFLAGS:append:riscv64 = " -pthread" + +# Need toku_time_now() implemented for ppc/musl +# see utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +COMPATIBLE_HOST:libc-musl:powerpc = "null" -- cgit 1.2.3-korg