Skip to content

Commit 2ad9544

Browse files
authored
Merge with upstream rocksdb v7.10.2 (#276)
Merge with upstream tag: v7.10.2. Igor made a PR on this a few months ago, but that branch had conflicts with recent Rocksdb-Cloud changes. So I simply made another one. To resolve conflicts, I made following changes: * remove MaybeVerifyFileChecksums function . This function has been removed in upstream but somehow kept in our repo. Probably we forgot to remove it in previous merge. Removing it since it's causing conflict during merge * Revert a revert commit in v7.8.3. Seems the original commit had a bug and it got reverted in v7.8.3, but the revert commit wasn't included in v7.10.2 (I guess it's fixed forward in master instead of getting reverted). This confuses git merge and I have to manually re-revert the revert commit before merging to get around the issue * Revert a revert commit in v7.8.3. Same reason as 2 * delete cloud_file_cache. we are not using CloudFileCache and it causes conflict during merging. So I simply removed it * Pluggable compaction to include unique id and epoch info. Two new fields are added in VersionEdit and we need to include them to make remote compaction work.
1 parent 0d2b895 commit 2ad9544

File tree

707 files changed

+24405
-18381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

707 files changed

+24405
-18381
lines changed

.circleci/config.yml

Lines changed: 61 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
win: circleci/windows@2.4.0
4+
win: circleci/windows@5.0.0
55

66
commands:
77
install-cmake-on-macos:
@@ -45,6 +45,38 @@ commands:
4545
echo "export LZ4_DOWNLOAD_BASE=https://rocksdb-deps.s3.us-west-2.amazonaws.com/pkgs/lz4" >> $BASH_ENV
4646
echo "export ZSTD_DOWNLOAD_BASE=https://rocksdb-deps.s3.us-west-2.amazonaws.com/pkgs/zstd" >> $BASH_ENV
4747
48+
windows-build-steps:
49+
steps:
50+
- checkout
51+
- run:
52+
name: "Install thirdparty dependencies"
53+
command: |
54+
echo "Installing CMake..."
55+
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
56+
mkdir $Env:THIRDPARTY_HOME
57+
cd $Env:THIRDPARTY_HOME
58+
echo "Building Snappy dependency..."
59+
curl https://github.com/google/snappy/archive/refs/tags/1.1.8.zip -O snappy-1.1.8.zip
60+
unzip -q snappy-1.1.8.zip
61+
cd snappy-1.1.8
62+
mkdir build
63+
cd build
64+
& $Env:CMAKE_BIN -G "$Env:CMAKE_GENERATOR" ..
65+
msbuild.exe Snappy.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64
66+
- run:
67+
name: "Build RocksDB"
68+
command: |
69+
mkdir build
70+
cd build
71+
& $Env:CMAKE_BIN -G "$Env:CMAKE_GENERATOR" -DCMAKE_BUILD_TYPE=Debug -DOPTDBG=1 -DPORTABLE=1 -DSNAPPY=1 -DJNI=1 ..
72+
cd ..
73+
echo "Building with VS version: $Env:CMAKE_GENERATOR"
74+
msbuild.exe build/rocksdb.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64
75+
- run:
76+
name: "Test RocksDB"
77+
shell: powershell.exe
78+
command: |
79+
build_tools\run_ci_db_test.ps1 -SuiteRun arena_test,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
4880
pre-steps-macos:
4981
steps:
5082
- pre-steps
@@ -154,11 +186,6 @@ commands:
154186
true
155187
156188
executors:
157-
windows-2xlarge:
158-
machine:
159-
image: 'windows-server-2019-vs2019:stable'
160-
resource_class: windows.2xlarge
161-
shell: bash.exe
162189
linux-docker:
163190
docker:
164191
# The image configuration is build_tools/ubuntu20_image/Dockerfile
@@ -518,73 +545,35 @@ jobs:
518545
no_output_timeout: 100m
519546
- post-steps
520547

521-
build-windows:
522-
executor: windows-2xlarge
523-
parameters:
524-
extra_cmake_opt:
525-
default: ""
526-
type: string
527-
vs_year:
528-
default: "2019"
529-
type: string
530-
cmake_generator:
531-
default: "Visual Studio 16 2019"
532-
type: string
548+
build-windows-vs2022:
549+
executor:
550+
name: win/server-2022
551+
size: 2xlarge
552+
environment:
553+
THIRDPARTY_HOME: C:/Users/circleci/thirdparty
554+
CMAKE_HOME: C:/Program Files/CMake
555+
CMAKE_BIN: C:/Program Files/CMake/bin/cmake.exe
556+
SNAPPY_HOME: C:/Users/circleci/thirdparty/snappy-1.1.8
557+
SNAPPY_INCLUDE: C:/Users/circleci/thirdparty/snappy-1.1.8;C:/Users/circleci/thirdparty/snappy-1.1.8/build
558+
SNAPPY_LIB_DEBUG: C:/Users/circleci/thirdparty/snappy-1.1.8/build/Debug/snappy.lib
559+
CMAKE_GENERATOR: Visual Studio 17 2022
560+
steps:
561+
- windows-build-steps
562+
563+
build-windows-vs2019:
564+
executor:
565+
name: win/server-2019
566+
size: 2xlarge
533567
environment:
534568
THIRDPARTY_HOME: C:/Users/circleci/thirdparty
535-
CMAKE_HOME: C:/Users/circleci/thirdparty/cmake-3.16.4-win64-x64
536-
CMAKE_BIN: C:/Users/circleci/thirdparty/cmake-3.16.4-win64-x64/bin/cmake.exe
537-
SNAPPY_HOME: C:/Users/circleci/thirdparty/snappy-1.1.7
538-
SNAPPY_INCLUDE: C:/Users/circleci/thirdparty/snappy-1.1.7;C:/Users/circleci/thirdparty/snappy-1.1.7/build
539-
SNAPPY_LIB_DEBUG: C:/Users/circleci/thirdparty/snappy-1.1.7/build/Debug/snappy.lib
540-
VS_YEAR: <<parameters.vs_year>>
541-
CMAKE_GENERATOR: <<parameters.cmake_generator>>
569+
CMAKE_HOME: C:/Program Files/CMake
570+
CMAKE_BIN: C:/Program Files/CMake/bin/cmake.exe
571+
SNAPPY_HOME: C:/Users/circleci/thirdparty/snappy-1.1.8
572+
SNAPPY_INCLUDE: C:/Users/circleci/thirdparty/snappy-1.1.8;C:/Users/circleci/thirdparty/snappy-1.1.8/build
573+
SNAPPY_LIB_DEBUG: C:/Users/circleci/thirdparty/snappy-1.1.8/build/Debug/snappy.lib
574+
CMAKE_GENERATOR: Visual Studio 16 2019
542575
steps:
543-
- checkout
544-
- run:
545-
name: "Setup VS"
546-
command: |
547-
if [[ "${VS_YEAR}" == "2019" ]]; then
548-
echo "VS2019 already present."
549-
elif [[ "${VS_YEAR}" == "2017" ]]; then
550-
echo "Installing VS2017..."
551-
powershell .circleci/vs2017_install.ps1
552-
elif [[ "${VS_YEAR}" == "2015" ]]; then
553-
echo "Installing VS2015..."
554-
powershell .circleci/vs2015_install.ps1
555-
fi
556-
- store_artifacts:
557-
path: \Users\circleci\AppData\Local\Temp\vslogs.zip
558-
- run:
559-
name: "Install thirdparty dependencies"
560-
command: |
561-
mkdir ${THIRDPARTY_HOME}
562-
cd ${THIRDPARTY_HOME}
563-
echo "Installing CMake..."
564-
curl --fail --silent --show-error --output cmake-3.16.4-win64-x64.zip --location https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-win64-x64.zip
565-
unzip -q cmake-3.16.4-win64-x64.zip
566-
echo "Building Snappy dependency..."
567-
curl --fail --silent --show-error --output snappy-1.1.7.zip --location https://github.com/google/snappy/archive/1.1.7.zip
568-
unzip -q snappy-1.1.7.zip
569-
cd snappy-1.1.7
570-
mkdir build
571-
cd build
572-
${CMAKE_BIN} -G "${CMAKE_GENERATOR}" ..
573-
msbuild.exe Snappy.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64
574-
- run:
575-
name: "Build RocksDB"
576-
command: |
577-
mkdir build
578-
cd build
579-
${CMAKE_BIN} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=Debug -DOPTDBG=1 -DPORTABLE=1 -DSNAPPY=1 -DJNI=1 << parameters.extra_cmake_opt >> ..
580-
cd ..
581-
echo "Building with VS version: ${CMAKE_GENERATOR}"
582-
msbuild.exe build/rocksdb.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64
583-
- run:
584-
name: "Test RocksDB"
585-
shell: powershell.exe
586-
command: |
587-
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
576+
- windows-build-steps
588577

589578
build-linux-java:
590579
executor: linux-docker
@@ -859,15 +848,8 @@ workflows:
859848
- build-linux-mini-crashtest
860849
jobs-windows:
861850
jobs:
862-
- build-windows:
863-
name: "build-windows-vs2019"
864-
- build-windows:
865-
name: "build-windows-vs2019-cxx20"
866-
extra_cmake_opt: -DCMAKE_CXX_STANDARD=20
867-
- build-windows:
868-
name: "build-windows-vs2017"
869-
vs_year: "2017"
870-
cmake_generator: "Visual Studio 15 Win64"
851+
- build-windows-vs2022
852+
- build-windows-vs2019
871853
- build-cmake-mingw
872854
jobs-java:
873855
jobs:

CMakeLists.txt

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,21 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
253253
endif(HAS_S390X_MARCH_NATIVE)
254254
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
255255

256+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
257+
CHECK_C_COMPILER_FLAG("-march=loongarch64" HAS_LOONGARCH64)
258+
if(HAS_LOONGARCH64)
259+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=loongarch64 -mtune=loongarch64")
260+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=loongarch64 -mtune=loongarch64")
261+
endif(HAS_LOONGARCH64)
262+
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
263+
256264
option(PORTABLE "build a portable binary" OFF)
257265
option(FORCE_SSE42 "force building with SSE4.2, even when PORTABLE=ON" OFF)
258266
option(FORCE_AVX "force building with AVX, even when PORTABLE=ON" OFF)
259267
option(FORCE_AVX2 "force building with AVX2, even when PORTABLE=ON" OFF)
260268
if(PORTABLE)
269+
add_definitions(-DROCKSDB_PORTABLE)
270+
261271
# MSVC does not need a separate compiler flag to enable SSE4.2; if nmmintrin.h
262272
# is available, it is available by default.
263273
if(FORCE_SSE42 AND NOT MSVC)
@@ -281,6 +291,9 @@ if(PORTABLE)
281291
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390x")
282292
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z196")
283293
endif()
294+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^loongarch64")
295+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=loongarch64")
296+
endif()
284297
endif()
285298
else()
286299
if(MSVC)
@@ -300,8 +313,7 @@ if(NOT MSVC)
300313
set(CMAKE_REQUIRED_FLAGS "-msse4.2 -mpclmul")
301314
endif()
302315

303-
if (NOT PORTABLE OR FORCE_SSE42)
304-
CHECK_CXX_SOURCE_COMPILES("
316+
CHECK_CXX_SOURCE_COMPILES("
305317
#include <cstdint>
306318
#include <nmmintrin.h>
307319
#include <wmmintrin.h>
@@ -313,12 +325,11 @@ int main() {
313325
auto d = _mm_cvtsi128_si64(c);
314326
}
315327
" HAVE_SSE42)
316-
if(HAVE_SSE42)
317-
add_definitions(-DHAVE_SSE42)
318-
add_definitions(-DHAVE_PCLMUL)
319-
elseif(FORCE_SSE42)
320-
message(FATAL_ERROR "FORCE_SSE42=ON but unable to compile with SSE4.2 enabled")
321-
endif()
328+
if(HAVE_SSE42)
329+
add_definitions(-DHAVE_SSE42)
330+
add_definitions(-DHAVE_PCLMUL)
331+
elseif(FORCE_SSE42)
332+
message(FATAL_ERROR "FORCE_SSE42=ON but unable to compile with SSE4.2 enabled")
322333
endif()
323334

324335
# Check if -latomic is required or not
@@ -657,12 +668,13 @@ set(SOURCES
657668
cache/cache.cc
658669
cache/cache_entry_roles.cc
659670
cache/cache_key.cc
671+
cache/cache_helpers.cc
660672
cache/cache_reservation_manager.cc
661673
cache/charged_cache.cc
662674
cache/clock_cache.cc
663675
cache/compressed_secondary_cache.cc
664-
cache/fast_lru_cache.cc
665676
cache/lru_cache.cc
677+
cache/secondary_cache.cc
666678
cache/sharded_cache.cc
667679
db/arena_wrapped_db_iter.cc
668680
db/blob/blob_contents.cc
@@ -804,6 +816,7 @@ set(SOURCES
804816
options/options.cc
805817
options/options_helper.cc
806818
options/options_parser.cc
819+
port/mmap.cc
807820
port/stack_trace.cc
808821
table/adaptive/adaptive_table_factory.cc
809822
table/block_based/binary_search_index_reader.cc
@@ -813,6 +826,7 @@ set(SOURCES
813826
table/block_based/block_based_table_iterator.cc
814827
table/block_based/block_based_table_reader.cc
815828
table/block_based/block_builder.cc
829+
table/block_based/block_cache.cc
816830
table/block_based/block_prefetcher.cc
817831
table/block_based/block_prefix_index.cc
818832
table/block_based/data_block_hash_index.cc
@@ -974,7 +988,6 @@ set(SOURCES
974988
cloud/cloud_manifest.cc
975989
cloud/cloud_scheduler.cc
976990
cloud/cloud_storage_provider.cc
977-
cloud/cloud_file_cache.cc
978991
cloud/cloud_file_deletion_scheduler.cc
979992
db/db_impl/db_impl_remote_compaction.cc
980993
db/db_impl/replication_codec.cc)
@@ -1004,6 +1017,12 @@ if ( ROCKSDB_PLUGINS )
10041017
plugin/${plugin}/${src}
10051018
PROPERTIES COMPILE_FLAGS "${${plugin}_COMPILE_FLAGS}")
10061019
endforeach()
1020+
foreach (test ${${plugin}_TESTS})
1021+
list(APPEND PLUGIN_TESTS plugin/${plugin}/${test})
1022+
set_source_files_properties(
1023+
plugin/${plugin}/${test}
1024+
PROPERTIES COMPILE_FLAGS "${${plugin}_COMPILE_FLAGS}")
1025+
endforeach()
10071026
foreach (path ${${plugin}_INCLUDE_PATHS})
10081027
include_directories(${path})
10091028
endforeach()
@@ -1501,6 +1520,7 @@ if(WITH_TESTS)
15011520
utilities/ttl/ttl_test.cc
15021521
utilities/util_merge_operators_test.cc
15031522
utilities/write_batch_with_index/write_batch_with_index_test.cc
1523+
${PLUGIN_TESTS}
15041524
)
15051525
endif()
15061526

@@ -1604,9 +1624,9 @@ endif()
16041624

16051625
option(WITH_TRACE_TOOLS "build with trace tools" ON)
16061626
if(WITH_TRACE_TOOLS)
1607-
add_executable(block_cache_trace_analyzer_tool${ARTIFACT_SUFFIX}
1627+
add_executable(block_cache_trace_analyzer${ARTIFACT_SUFFIX}
16081628
tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc)
1609-
target_link_libraries(block_cache_trace_analyzer_tool${ARTIFACT_SUFFIX}
1629+
target_link_libraries(block_cache_trace_analyzer${ARTIFACT_SUFFIX}
16101630
${ROCKSDB_LIB} ${GFLAGS_LIB} ${FOLLY_LIBS})
16111631

16121632
add_executable(trace_analyzer${ARTIFACT_SUFFIX}

0 commit comments

Comments
 (0)