[rocksdb] update to v6.13.3 (#14085)

This commit is contained in:
Koby Kahane 2020-10-21 02:12:34 +03:00 committed by GitHub
parent c2d1f57721
commit 4e3e210e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 178 additions and 106 deletions

View File

@ -1,13 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9c8f3346..248c0d2d8 100644
index 01eea8889..14a4b1a40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -975,7 +975,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS)
endif()
@@ -1015,7 +1015,7 @@ endif()
option(WITH_ALL_TESTS "Build all test, rather than a small subset" ON)
if(WITH_TESTS)
if(WITH_TESTS OR WITH_BENCHMARK_TOOLS)
- add_subdirectory(third-party/gtest-1.8.1/fused-src/gtest)
+ #add_subdirectory(third-party/gtest-1.8.1/fused-src/gtest)
add_library(testharness STATIC
test_util/mock_time_env.cc
test_util/testharness.cc)
target_link_libraries(testharness gtest)

View File

@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9c8f3346..59747a684 100644
index 36eddb32b..97a93601b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,7 +91,7 @@ include(CMakeDependentOption)
@ -11,3 +11,28 @@ index f9c8f3346..59747a684 100644
option(WITH_XPRESS "build with windows built in compression" OFF)
include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc)
else()
@@ -130,10 +130,7 @@ else()
endif()
if(WITH_SNAPPY)
- find_package(Snappy CONFIG)
- if(NOT Snappy_FOUND)
- find_package(Snappy REQUIRED)
- endif()
+ find_package(Snappy CONFIG REQUIRED)
add_definitions(-DSNAPPY)
list(APPEND THIRDPARTY_LIBS Snappy::snappy)
endif()
@@ -163,10 +160,9 @@ else()
endif()
if(WITH_ZSTD)
- find_package(zstd REQUIRED)
+ find_package(zstd CONFIG REQUIRED)
add_definitions(-DZSTD)
- include_directories(${ZSTD_INCLUDE_DIR})
- list(APPEND THIRDPARTY_LIBS zstd::zstd)
+ list(APPEND THIRDPARTY_LIBS libzstd)
endif()
endif()

View File

@ -1,3 +1,51 @@
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d656a1961..c088ee4ee 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -234,7 +234,7 @@ jobs:
name: "Test RocksDB"
shell: powershell.exe
command: |
- build_tools\run_ci_db_test.ps1 -SuiteRun db_basic_test,db_test,db_test2,env_basic_test,env_test,db_merge_operand_test -Concurrency 16
+ build_tools\run_ci_db_test.ps1 -SuiteRun db_basic_test,db_test,db_test2,db_merge_operand_test,bloom_test,c_test,coding_test,crc32c_test,dynamic_bloom_test,env_basic_test,env_test,hash_test,random_test -Concurrency 16
build-linux-java:
machine:
diff --git a/db/c_test.c b/db/c_test.c
index 4fb7d016d..a01336738 100644
--- a/db/c_test.c
+++ b/db/c_test.c
@@ -58,7 +58,11 @@ static void StartPhase(const char* name) {
static const char* GetTempDir(void) {
const char* ret = getenv("TEST_TMPDIR");
if (ret == NULL || ret[0] == '\0')
- ret = "/tmp";
+#ifdef OS_WIN
+ ret = getenv("TEMP");
+#else
+ ret = "/tmp";
+#endif
return ret;
}
#ifdef _MSC_VER
diff --git a/db/perf_context_test.cc b/db/perf_context_test.cc
index 0410ada7a..5a714b9b8 100644
--- a/db/perf_context_test.cc
+++ b/db/perf_context_test.cc
@@ -817,6 +817,13 @@ TEST_F(PerfContextTest, PerfContextByLevelGetSet) {
}
TEST_F(PerfContextTest, CPUTimer) {
+ if (Env::Default()->NowCPUNanos() == 0) {
+ // TODO: This should be a GTEST_SKIP when the embedded gtest is updated
+ // to 1.10 or higher.
+ GTEST_SUCCESS_("Skipped on target without NowCPUNanos support");
+ return;
+ }
+
DestroyDB(kDbName, Options());
auto db = OpenDb();
WriteOptions write_options;
diff --git a/file/filename.cc b/file/filename.cc
index 968adbaa7..0ac4e6ef8 100644
--- a/file/filename.cc
@ -14,16 +62,17 @@ index 968adbaa7..0ac4e6ef8 100644
}
dst.push_back(c);
diff --git a/port/win/port_win.cc b/port/win/port_win.cc
index 2d99a7a9b..34f6b28de 100644
index 2d99a7a9b..f33ee20c4 100644
--- a/port/win/port_win.cc
+++ b/port/win/port_win.cc
@@ -100,6 +100,14 @@ bool CondVar::TimedWait(uint64_t abs_time_us) {
@@ -100,6 +100,15 @@ bool CondVar::TimedWait(uint64_t abs_time_us) {
// Caller must ensure that mutex is held prior to calling this method
std::unique_lock<std::mutex> lk(mu_->getLock(), std::adopt_lock);
+
+ // Work around https://github.com/microsoft/STL/issues/369
+#if defined(_MSC_VER) && (!defined(_MSVC_STL_UPDATE) || _MSVC_STL_UPDATE < 202008L)
+#if defined(_MSC_VER) && \
+ (!defined(_MSVC_STL_UPDATE) || _MSVC_STL_UPDATE < 202008L)
+ if (relTimeUs == microseconds::zero()) {
+ lk.unlock();
+ lk.lock();
@ -67,13 +116,74 @@ index ec7be82e8..6635b8717 100644
return __rdtsc();
#elif __GNUC__ && (__i386__ || FOLLY_X64)
return __builtin_ia32_rdtsc();
diff --git a/util/filelock_test.cc b/util/filelock_test.cc
index 611cd46c6..fe2f7e0d8 100644
--- a/util/filelock_test.cc
+++ b/util/filelock_test.cc
@@ -127,9 +127,11 @@ TEST_F(LockTest, LockBySameThread) {
// re-acquire the lock on the same file. This should fail.
Status s = LockFile(&lock2);
ASSERT_TRUE(s.IsIOError());
+#ifndef OS_WIN
// Validate that error message contains current thread ID.
ASSERT_TRUE(s.ToString().find(ToString(Env::Default()->GetThreadID())) !=
std::string::npos);
+#endif
// check the file is locked
ASSERT_TRUE( AssertFileIsLocked() );
diff --git a/util/math.h b/util/math.h
index 64cdb2f44..514943164 100644
index 2e57c1c08..24fc840e4 100644
--- a/util/math.h
+++ b/util/math.h
@@ -13,24 +13,75 @@
namespace ROCKSDB_NAMESPACE {
@@ -21,13 +21,23 @@ inline int FloorLog2(T v) {
assert(v > 0);
#ifdef _MSC_VER
static_assert(sizeof(T) <= sizeof(uint64_t), "type too big");
- unsigned long lz = 0;
+ unsigned long idx = 0;
if (sizeof(T) <= sizeof(uint32_t)) {
- _BitScanReverse(&lz, static_cast<uint32_t>(v));
+ _BitScanReverse(&idx, static_cast<uint32_t>(v));
} else {
- _BitScanReverse64(&lz, static_cast<uint64_t>(v));
+#if defined(_M_X64) || defined(_M_ARM64)
+ _BitScanReverse64(&idx, static_cast<uint64_t>(v));
+#else
+ const auto vh = static_cast<uint32_t>(static_cast<uint64_t>(v) >> 32);
+ if (vh != 0) {
+ _BitScanReverse(&idx, static_cast<uint32_t>(vh));
+ idx += 32;
+ } else {
+ _BitScanReverse(&idx, static_cast<uint32_t>(v));
+ }
+#endif
}
- return 63 - static_cast<int>(lz);
+ return idx;
#else
static_assert(sizeof(T) <= sizeof(unsigned long long), "type too big");
if (sizeof(T) <= sizeof(unsigned int)) {
@@ -54,7 +64,16 @@ inline int CountTrailingZeroBits(T v) {
if (sizeof(T) <= sizeof(uint32_t)) {
_BitScanForward(&tz, static_cast<uint32_t>(v));
} else {
+#if defined(_M_X64) || defined(_M_ARM64)
_BitScanForward64(&tz, static_cast<uint64_t>(v));
+#else
+ _BitScanForward(&tz, static_cast<uint32_t>(v));
+ if (tz == 0) {
+ _BitScanForward(&tz,
+ static_cast<uint32_t>(static_cast<uint64_t>(v) >> 32));
+ tz += 32;
+ }
+#endif
}
return static_cast<int>(tz);
#else
@@ -69,6 +88,29 @@ inline int CountTrailingZeroBits(T v) {
#endif
}
+#if defined(_MSC_VER) && !defined(_M_X64)
+namespace detail {
@ -81,7 +191,8 @@ index 64cdb2f44..514943164 100644
+int BitsSetToOneFallback(T v) {
+ const int kBits = static_cast<int>(sizeof(T)) * 8;
+ static_assert((kBits & (kBits - 1)) == 0, "must be power of two bits");
+ // we static_cast these bit patterns in order to truncate them to the correct size
+ // we static_cast these bit patterns in order to truncate them to the correct
+ // size
+ v = static_cast<T>(v - ((v >> 1) & static_cast<T>(0x5555555555555555ull)));
+ v = static_cast<T>((v & static_cast<T>(0x3333333333333333ull)) +
+ ((v >> 2) & static_cast<T>(0x3333333333333333ull)));
@ -89,42 +200,35 @@ index 64cdb2f44..514943164 100644
+ for (int shift_bits = 8; shift_bits < kBits; shift_bits <<= 1) {
+ v += static_cast<T>(v >> shift_bits);
+ }
+ // we want the bottom "slot" that's big enough to store kDigits
+ // we want the bottom "slot" that's big enough to represent a value up to
+ // (and including) kBits.
+ return static_cast<int>(v & static_cast<T>(kBits | (kBits - 1)));
+}
+
+} // namespace detail
+} // namespace detail
+#endif
+
+// Number of bits set to 1. Also known as "population count".
// Number of bits set to 1. Also known as "population count".
template <typename T>
inline int BitsSetToOne(T v) {
static_assert(std::is_integral<T>::value, "non-integral type");
#ifdef _MSC_VER
static_assert(sizeof(T) <= sizeof(uint64_t), "type too big");
- if (sizeof(T) > sizeof(uint32_t)) {
- return static_cast<int>(__popcnt64(static_cast<uint64_t>(v)));
- } else {
+ if (sizeof(T) < sizeof(uint32_t)) {
+ // This bit mask is to avoid a compiler warning on unused path
+ constexpr auto mm = 8 * sizeof(uint32_t) - 1;
+ // The bit mask is to neutralize sign extension on small signed types
+ constexpr uint32_t m = (uint32_t{1} << ((8 * sizeof(T)) & mm)) - 1;
@@ -80,11 +122,27 @@ inline int BitsSetToOne(T v) {
constexpr auto mm = 8 * sizeof(uint32_t) - 1;
// The bit mask is to neutralize sign extension on small signed types
constexpr uint32_t m = (uint32_t{1} << ((8 * sizeof(T)) & mm)) - 1;
+#if defined(_M_X64) || defined(_M_IX86)
+ return static_cast<int>(__popcnt(static_cast<uint32_t>(v) & m));
return static_cast<int>(__popcnt(static_cast<uint32_t>(v) & m));
+#else
+ return static_cast<int>(detail::BitsSetToOneFallback(v) & m);
+#endif
+ } else if (sizeof(T) == sizeof(uint32_t)) {
} else if (sizeof(T) == sizeof(uint32_t)) {
+#if defined(_M_X64) || defined(_M_IX86)
return static_cast<int>(__popcnt(static_cast<uint32_t>(v)));
+#else
+ return detail::BitsSetToOneFallback(static_cast<uint32_t>(v));
+#endif
+ } else {
} else {
+#ifdef _M_X64
+ return static_cast<int>(__popcnt64(static_cast<uint64_t>(v)));
return static_cast<int>(__popcnt64(static_cast<uint64_t>(v)));
+#elif defined(_M_IX86)
+ return static_cast<int>(
+ __popcnt(static_cast<uint32_t>(static_cast<uint64_t>(v) >> 32) +
@ -135,35 +239,18 @@ index 64cdb2f44..514943164 100644
}
#else
static_assert(sizeof(T) <= sizeof(unsigned long long), "type too big");
- if (sizeof(T) > sizeof(unsigned long)) {
- return __builtin_popcountll(static_cast<unsigned long long>(v));
- } else if (sizeof(T) > sizeof(unsigned int)) {
+ if (sizeof(T) < sizeof(unsigned int)) {
+ // This bit mask is to avoid a compiler warning on unused path
+ constexpr auto mm = 8 * sizeof(unsigned int) - 1;
+ // This bit mask is to neutralize sign extension on small signed types
+ constexpr unsigned int m = (1U << ((8 * sizeof(T)) & mm)) - 1;
+ return __builtin_popcount(static_cast<unsigned int>(v) & m);
+ } else if (sizeof(T) == sizeof(unsigned int)) {
+ return __builtin_popcount(static_cast<unsigned int>(v));
+ } else if (sizeof(T) <= sizeof(unsigned long)) {
return __builtin_popcountl(static_cast<unsigned long>(v));
} else {
- return __builtin_popcount(static_cast<unsigned int>(v));
+ return __builtin_popcountll(static_cast<unsigned long long>(v));
}
#endif
}
diff --git a/util/xxh3p.h b/util/xxh3p.h
index d1fc2bba2..c63f0e36d 100644
index d1fc2bba2..05696cecd 100644
--- a/util/xxh3p.h
+++ b/util/xxh3p.h
@@ -253,7 +253,7 @@ XXH_FORCE_INLINE U64x2 XXH_vec_mule(U32x4 a, U32x4 b) {
@@ -253,7 +253,9 @@ XXH_FORCE_INLINE U64x2 XXH_vec_mule(U32x4 a, U32x4 b) {
#if defined(XXH_NO_PREFETCH)
# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */
#else
-# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */
+# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) /* _mm_prefetch() is not defined outside of x86/x64 */
+#if defined(_MSC_VER) && \
+ (defined(_M_X64) || \
+ defined(_M_IX86)) /* _mm_prefetch() is not defined outside of x86/x64 */
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
# define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0)
# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) )

View File

@ -1,5 +1,5 @@
Source: rocksdb
Version: 6.11.4
Version: 6.13.3
Homepage: https://github.com/facebook/rocksdb
Description: A library that provides an embeddable, persistent key-value store for fast storage
Default-Features: zlib
@ -23,3 +23,7 @@ Description: tbb support in rocksdb
Feature: zstd
Build-Depends: zstd
Description: zstd support in rocksdb
Feature: bzip2
Build-Depends: bzip2
Description: bzip2 support in rocksdb

View File

@ -1,13 +0,0 @@
find_path(LZ4_INCLUDE_DIR lz4.h)
find_library(LZ4_LIBRARY_DEBUG NAMES lz4d)
find_library(LZ4_LIBRARY_RELEASE NAMES lz4)
include(SelectLibraryConfigurations)
select_library_configurations(LZ4)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LZ4 DEFAULT_MSG
LZ4_LIBRARY LZ4_INCLUDE_DIR
)

View File

@ -1,13 +0,0 @@
find_path(SNAPPY_INCLUDE_DIR snappy.h)
find_library(SNAPPY_LIBRARY_DEBUG NAMES snappyd)
find_library(SNAPPY_LIBRARY_RELEASE NAMES snappy)
include(SelectLibraryConfigurations)
select_library_configurations(SNAPPY)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
SNAPPY DEFAULT_MSG
SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR
)

View File

@ -1,13 +0,0 @@
find_path(ZSTD_INCLUDE_DIR zstd.h)
find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd_staticd)
find_library(ZSTD_LIBRARY_RELEASE NAMES zstd zstd_static)
include(SelectLibraryConfigurations)
select_library_configurations(ZSTD)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
ZSTD DEFAULT_MSG
ZSTD_LIBRARY ZSTD_INCLUDE_DIR
)

View File

@ -3,23 +3,15 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/rocksdb
REF v6.11.4
SHA512 46ee38930aee58541366c92ca5cda48c2856292e5e3d66830035b05bb114b01d23ea2c8ee5e2abd971699f5c789adb6038971c3f07c8d68039ddea67d1357d05
REF v6.13.3
SHA512 9c1a9de2321d86a454e4fddc72965c55352902d4f55fc2e5bdc8cc5f081e8a2251a431c29c7a6108504456b148c4244a18bab2b261aaad9afcf290ae9cd5d724
HEAD_REF master
PATCHES
0001-disable-gtest.patch
0002-only-build-one-flavor.patch
0003-use-find-package.patch
0004-add-config-to-findpackage.patch
0005-backport-msvc-fixes-pr-7439.patch
)
file(REMOVE "${SOURCE_PATH}/cmake/modules/Findzlib.cmake")
file(COPY
"${CMAKE_CURRENT_LIST_DIR}/Findlz4.cmake"
"${CMAKE_CURRENT_LIST_DIR}/Findsnappy.cmake"
"${CMAKE_CURRENT_LIST_DIR}/Findzstd.cmake"
DESTINATION "${SOURCE_PATH}/cmake/modules"
0005-backport-msvc-fixes-pr-7439.patch # https://github.com/facebook/rocksdb/pull/7439
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" WITH_MD_LIBRARY)
@ -31,6 +23,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
"snappy" WITH_SNAPPY
"zlib" WITH_ZLIB
"zstd" WITH_ZSTD
"bzip2" WITH_BZ2
"tbb" WITH_TBB
INVERTED_FEATURES
"tbb" CMAKE_DISABLE_FIND_PACKAGE_TBB
@ -40,9 +33,11 @@ vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DWITH_GFLAGS=0
-DWITH_GFLAGS=OFF
-DWITH_TESTS=OFF
-DWITH_BENCHMARK_TOOLS=OFF
-DWITH_TOOLS=OFF
-DWITH_FOLLY_DISTRIBUTED_MUTEX=OFF
-DUSE_RTTI=1
-DROCKSDB_INSTALL_ON_WINDOWS=ON
-DFAIL_ON_WARNINGS=OFF