Skip to content

Commit 58bf591

Browse files
committed
Merge commit '31dfc81e1852fde0a7b5d88f0f0cc0f9c9de11f7' of github.com:arangodb/rocksdb into upgrade-7.7
2 parents 1e9ad81 + 31dfc81 commit 58bf591

File tree

518 files changed

+12015
-8577
lines changed

Some content is hidden

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

518 files changed

+12015
-8577
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ jobs:
547547
resource_class: large
548548
steps:
549549
- pre-steps
550-
- run: ulimit -S -n `ulimit -H -n` && make V=1 -j8 CRASH_TEST_EXT_ARGS='--duration=960 --max_key=2500000 --use_io_uring=0' blackbox_crash_test_with_atomic_flush
550+
- run: ulimit -S -n `ulimit -H -n` && make V=1 -j8 CRASH_TEST_EXT_ARGS='--duration=960 --max_key=2500000' blackbox_crash_test_with_atomic_flush
551551
- post-steps
552552

553553
build-linux-crashtest-tiered-storage-bb:
@@ -557,7 +557,7 @@ jobs:
557557
- pre-steps
558558
- run:
559559
name: "run crashtest"
560-
command: ulimit -S -n `ulimit -H -n` && make V=1 -j32 CRASH_TEST_EXT_ARGS='--duration=10800 --use_io_uring=0' blackbox_crash_test_with_tiered_storage
560+
command: ulimit -S -n `ulimit -H -n` && make V=1 -j32 CRASH_TEST_EXT_ARGS='--duration=10800' blackbox_crash_test_with_tiered_storage
561561
no_output_timeout: 100m
562562
- post-steps
563563

@@ -568,7 +568,7 @@ jobs:
568568
- pre-steps
569569
- run:
570570
name: "run crashtest"
571-
command: ulimit -S -n `ulimit -H -n` && make V=1 -j32 CRASH_TEST_EXT_ARGS='--duration=10800 --use_io_uring=0' whitebox_crash_test_with_tiered_storage
571+
command: ulimit -S -n `ulimit -H -n` && make V=1 -j32 CRASH_TEST_EXT_ARGS='--duration=10800' whitebox_crash_test_with_tiered_storage
572572
no_output_timeout: 100m
573573
- post-steps
574574

.github/workflows/pr-jobs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ jobs:
352352
steps:
353353
- uses: actions/[email protected]
354354
- uses: "./.github/actions/pre-steps"
355-
- run: ulimit -S -n `ulimit -H -n` && make V=1 -j8 CRASH_TEST_EXT_ARGS='--duration=960 --max_key=2500000 --use_io_uring=0' blackbox_crash_test_with_atomic_flush
355+
- run: ulimit -S -n `ulimit -H -n` && make V=1 -j8 CRASH_TEST_EXT_ARGS='--duration=960 --max_key=2500000' blackbox_crash_test_with_atomic_flush
356356
- uses: "./.github/actions/post-steps"
357357
# ======================= Linux with Sanitizers ===================== #
358358
build-linux-clang10-asan:
@@ -403,7 +403,7 @@ jobs:
403403
- uses: "./.github/actions/pre-steps"
404404
- run: ASSERT_STATUS_CHECKED=1 TEST_UINT128_COMPAT=1 ROCKSDB_MODIFY_NPHASH=1 LIB_MODE=static OPT="-DROCKSDB_NAMESPACE=alternative_rocksdb_ns" make V=1 -j24 check
405405
- uses: "./.github/actions/post-steps"
406-
# ========================= MacOS with Tests ======================== #
406+
# ========================= MacOS build only ======================== #
407407
build-macos:
408408
if: ${{ github.repository_owner == 'facebook' }}
409409
runs-on: macos-13
@@ -417,9 +417,10 @@ jobs:
417417
- uses: "./.github/actions/increase-max-open-files-on-macos"
418418
- uses: "./.github/actions/install-gflags-on-macos"
419419
- uses: "./.github/actions/pre-steps-macos"
420-
- name: Run all tests
420+
- name: Build
421421
run: ulimit -S -n `ulimit -H -n` && make V=1 J=16 -j16 all
422422
- uses: "./.github/actions/post-steps"
423+
# ========================= MacOS with Tests ======================== #
423424
build-macos-cmake:
424425
if: ${{ github.repository_owner == 'facebook' }}
425426
runs-on: macos-13
@@ -605,4 +606,4 @@ jobs:
605606
- uses: actions/[email protected]
606607
with:
607608
name: maven-site
608-
path: "${{ github.workspace }}/java/target/site"
609+
path: "${{ github.workspace }}/java/target/site"

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ else()
180180
if(WITH_ZSTD)
181181
find_package(zstd REQUIRED)
182182
add_definitions(-DZSTD)
183-
include_directories(${ZSTD_INCLUDE_DIR})
183+
include_directories(${ZSTD_INCLUDE_DIRS})
184184
list(APPEND THIRDPARTY_LIBS zstd::zstd)
185185
endif()
186186
endif()
@@ -385,7 +385,7 @@ option(WITH_NUMA "build with NUMA policy support" OFF)
385385
if(WITH_NUMA)
386386
find_package(NUMA REQUIRED)
387387
add_definitions(-DNUMA)
388-
include_directories(${NUMA_INCLUDE_DIR})
388+
include_directories(${NUMA_INCLUDE_DIRS})
389389
list(APPEND THIRDPARTY_LIBS NUMA::NUMA)
390390
endif()
391391

HISTORY.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
# Rocksdb Change Log
22
> NOTE: Entries for next release do not go here. Follow instructions in `unreleased_history/README.txt`
33
4+
## 9.0.0 (02/16/2024)
5+
### New Features
6+
* Provide support for FSBuffer for point lookups. Also added support for scans and compactions that don't go through prefetching.
7+
* *Make `SstFileWriter` create SST files without persisting user defined timestamps when the `Option.persist_user_defined_timestamps` flag is set to false.
8+
* Add support for user-defined timestamps in APIs `DeleteFilesInRanges` and `GetPropertiesOfTablesInRange`.
9+
* Mark wal\_compression feature as production-ready. Currently only compatible with ZSTD compression.
10+
11+
### Public API Changes
12+
* Allow setting Stderr logger via C API
13+
* Declare one Get and one MultiGet variant as pure virtual, and make all the other variants non-overridable. The methods required to be implemented by derived classes of DB allow returning timestamps. It is up to the implementation to check and return an error if timestamps are not supported. The non-batched MultiGet APIs are reimplemented in terms of batched MultiGet, so callers might see a performance improvement.
14+
* Exposed mode option to Rate Limiter via c api.
15+
* Removed deprecated option `access_hint_on_compaction_start`
16+
* Removed deprecated option `ColumnFamilyOptions::check_flush_compaction_key_order`
17+
* *Remove the default `WritableFile::GetFileSize` and `FSWritableFile::GetFileSize` implementation that returns 0 and make it pure virtual, so that subclasses are enforced to explicitly provide an implementation.
18+
* Removed deprecated option `ColumnFamilyOptions::level_compaction_dynamic_file_size`
19+
* *Removed tickers with typos "rocksdb.error.handler.bg.errro.count", "rocksdb.error.handler.bg.io.errro.count", "rocksdb.error.handler.bg.retryable.io.errro.count".
20+
* Remove the force mode for `EnableFileDeletions` API because it is unsafe with no known legitimate use.
21+
* Removed deprecated option `ColumnFamilyOptions::ignore_max_compaction_bytes_for_input`
22+
* `sst_dump --command=check` now compares the number of records in a table with `num_entries` in table property, and reports corruption if there is a mismatch. API `SstFileDumper::ReadSequential()` is updated to optionally do this verification. (#12322)
23+
24+
### Behavior Changes
25+
* format\_version=6 is the new default setting in BlockBasedTableOptions, for more robust data integrity checking. DBs and SST files written with this setting cannot be read by RocksDB versions before 8.6.0.
26+
* Compactions can be scheduled in parallel in an additional scenario: multiple files are marked for compaction within a single column family
27+
* For leveled compaction, RocksDB will try to do intra-L0 compaction if the total L0 size is small compared to Lbase (#12214). Users with atomic_flush=true are more likely to see the impact of this change.
28+
29+
### Bug Fixes
30+
* Fixed a data race in `DBImpl::RenameTempFileToOptionsFile`.
31+
* Fix some perf context statistics error in write steps. which include missing write_memtable_time in unordered_write. missing write_memtable_time in PipelineWrite when Writer stat is STATE_PARALLEL_MEMTABLE_WRITER. missing write_delay_time when calling DelayWrite in WriteImplWALOnly function.
32+
* Fixed a bug that can, under rare circumstances, cause MultiGet to return an incorrect result for a duplicate key in a MultiGet batch.
33+
* Fix a bug where older data of an ingested key can be returned for read when universal compaction is used
34+
435
## 8.11.0 (01/19/2024)
536
### New Features
637
* Add new statistics: `rocksdb.sst.write.micros` measures time of each write to SST file; `rocksdb.file.write.{flush|compaction|db.open}.micros` measure time of each write to SST table (currently only block-based table format) and blob file for flush, compaction and db open.

INSTALL.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,26 @@ most processors made since roughly 2013.
169169

170170
* Install the dependencies for RocksDB:
171171

172-
pkg_add gmake gflags snappy bzip2 lz4 zstd git jdk bash findutils gnuwatch
172+
`pkg_add gmake gflags snappy bzip2 lz4 zstd git bash findutils gnuwatch`
173173

174174
* Build RocksDB from source:
175175

176+
```bash
176177
cd ~
177178
git clone https://github.com/facebook/rocksdb.git
178179
cd rocksdb
179180
gmake static_lib
181+
```
180182

181183
* Build RocksJava from source (optional):
182-
184+
* In OpenBSD, JDK depends on XWindows system, so please check that you installed OpenBSD with `xbase` package.
185+
* Install dependencies : `pkg_add -v jdk%1.8`
186+
```bash
183187
cd rocksdb
184188
export JAVA_HOME=/usr/local/jdk-1.8.0
185189
export PATH=$PATH:/usr/local/jdk-1.8.0/bin
186-
gmake rocksdbjava
190+
gmake rocksdbjava SHA256_CMD='sha256 -q'
191+
```
187192

188193
* **iOS**:
189194
* Run: `TARGET_OS=IOS make static_lib`. When building the project which uses rocksdb iOS library, make sure to define an important pre-processing macros: `IOS_CROSS_COMPILE`.

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ endif
539539

540540
ifdef USE_CLANG
541541
# Used by some teams in Facebook
542-
WARNING_FLAGS += -Wshift-sign-overflow -Wambiguous-reversed-operator -Wimplicit-fallthrough
542+
WARNING_FLAGS += -Wshift-sign-overflow -Wambiguous-reversed-operator \
543+
-Wimplicit-fallthrough -Wreinterpret-base-class -Wundefined-reinterpret-cast
543544
endif
544545

545546
ifeq ($(PLATFORM), OS_OPENBSD)
@@ -2097,8 +2098,8 @@ ROCKSDB_JAVADOCS_JAR = rocksdbjni-$(ROCKSDB_JAVA_VERSION)-javadoc.jar
20972098
ROCKSDB_SOURCES_JAR = rocksdbjni-$(ROCKSDB_JAVA_VERSION)-sources.jar
20982099
SHA256_CMD = sha256sum
20992100

2100-
ZLIB_VER ?= 1.3
2101-
ZLIB_SHA256 ?= ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e
2101+
ZLIB_VER ?= 1.3.1
2102+
ZLIB_SHA256 ?= 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
21022103
ZLIB_DOWNLOAD_BASE ?= http://zlib.net
21032104
BZIP2_VER ?= 1.0.8
21042105
BZIP2_SHA256 ?= ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269

build_tools/build_detect_platform

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ fi
618618

619619
# TODO(tec): Fix -Wshorten-64-to-32 errors on FreeBSD and enable the warning.
620620
# -Wshorten-64-to-32 breaks compilation on FreeBSD aarch64 and i386
621-
if ! { [ "$TARGET_OS" = FreeBSD ] && [ "$TARGET_ARCHITECTURE" = arm64 -o "$TARGET_ARCHITECTURE" = i386 ]; }; then
621+
if ! { [ "$TARGET_OS" = FreeBSD -o "$TARGET_OS" = OpenBSD ] && [ "$TARGET_ARCHITECTURE" = arm64 -o "$TARGET_ARCHITECTURE" = i386 ]; }; then
622622
# Test whether -Wshorten-64-to-32 is available
623623
$CXX $PLATFORM_CXXFLAGS -x c++ - -o test.o -Wshorten-64-to-32 2>/dev/null <<EOF
624624
int main() {}
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
22
# The file is generated using update_dependencies.sh.
3-
GCC_BASE=/mnt/gvfs/third-party2/gcc/e40bde78650fa91b8405a857e3f10bf336633fb0/11.x/centos7-native/886b5eb
4-
CLANG_BASE=/mnt/gvfs/third-party2/llvm-fb/2043340983c032915adbb6f78903dc855b65aee8/12/platform010/9520e0f
5-
LIBGCC_BASE=/mnt/gvfs/third-party2/libgcc/c00dcc6a3e4125c7e8b248e9a79c14b78ac9e0ca/11.x/platform010/5684a5a
6-
GLIBC_BASE=/mnt/gvfs/third-party2/glibc/0b9c8e4b060eda62f3bc1c6127bbe1256697569b/2.34/platform010/f259413
7-
SNAPPY_BASE=/mnt/gvfs/third-party2/snappy/bc9647f7912b131315827d65cb6189c21f381d05/1.1.3/platform010/76ebdda
8-
ZLIB_BASE=/mnt/gvfs/third-party2/zlib/a6f5f3f1d063d2d00cd02fc12f0f05fc3ab3a994/1.2.11/platform010/76ebdda
3+
GCC_BASE=/mnt/gvfs/third-party2/gcc/b30c2e3be652b0135fb3df27fdef5eb4ffc2dc6d/11.x/centos9-native/886b5eb
4+
CLANG_BASE=/mnt/gvfs/third-party2/llvm-fb/1f6edd1ff15c99c861afc8f3cd69054cd974dd64/15/platform010/72a2ff8
5+
LIBGCC_BASE=/mnt/gvfs/third-party2/libgcc/d1129753c8361ac8e9453c0f4291337a4507ebe6/11.x/platform010/5684a5a
6+
GLIBC_BASE=/mnt/gvfs/third-party2/glibc/fed6e93d87571fb162734c86636119d45a398963/2.34/platform010/f259413
7+
SNAPPY_BASE=/mnt/gvfs/third-party2/snappy/31a346126a1f3b64812c362511cb04cc1bd40855/1.1.8/platform010/76ebdda
8+
ZLIB_BASE=/mnt/gvfs/third-party2/zlib/0c65c05468b5a38cef1a106a1f526463e120c8dd/1.2.8/platform010/76ebdda
99
BZIP2_BASE=/mnt/gvfs/third-party2/bzip2/09703139cfc376bd8a82642385a0e97726b28287/1.0.6/platform010/76ebdda
10-
LZ4_BASE=/mnt/gvfs/third-party2/lz4/60220d6a5bf7722b9cc239a1368c596619b12060/1.9.1/platform010/76ebdda
11-
ZSTD_BASE=/mnt/gvfs/third-party2/zstd/50eace8143eaaea9473deae1f3283e0049e05633/1.4.x/platform010/64091f4
12-
GFLAGS_BASE=/mnt/gvfs/third-party2/gflags/5d27e5919771603da06000a027b12f799e58a4f7/2.2.0/platform010/76ebdda
13-
JEMALLOC_BASE=/mnt/gvfs/third-party2/jemalloc/b62912d333ef33f9760efa6219dbe3fe6abb3b0e/master/platform010/f57cc4a
14-
NUMA_BASE=/mnt/gvfs/third-party2/numa/6b412770957aa3c8a87e5e0dcd8cc2f45f393bc0/2.0.11/platform010/76ebdda
15-
LIBUNWIND_BASE=/mnt/gvfs/third-party2/libunwind/52f69816e936e147664ad717eb71a1a0e9dc973a/1.4/platform010/5074a48
16-
TBB_BASE=/mnt/gvfs/third-party2/tbb/c9cc192099fa84c0dcd0ffeedd44a373ad6e4925/2018_U5/platform010/76ebdda
10+
LZ4_BASE=/mnt/gvfs/third-party2/lz4/ff23d17b932725cc1734a14896a8b67c518ba169/1.9.4/platform010/76ebdda
11+
ZSTD_BASE=/mnt/gvfs/third-party2/zstd/576397d8b1d9cea7306ad1e454d5e55caaa2ff1c/1.4.x/platform010/64091f4
12+
GFLAGS_BASE=/mnt/gvfs/third-party2/gflags/fecac07861cb829f5e60dbeff0503d3272db73c0/2.2.0/platform010/76ebdda
13+
JEMALLOC_BASE=/mnt/gvfs/third-party2/jemalloc/0bb3f5756788ce26e2e16a1cb2f2af2c59b51abe/master/platform010/f57cc4a
14+
NUMA_BASE=/mnt/gvfs/third-party2/numa/5b602edd46fda54cdd7ea45f77dbe4061206e174/2.0.11/platform010/76ebdda
15+
LIBUNWIND_BASE=/mnt/gvfs/third-party2/libunwind/97cac22a149c2e202917e05d44e87e516b68216f/1.4/platform010/5074a48
16+
TBB_BASE=/mnt/gvfs/third-party2/tbb/53953ebc4e3eda85ad6fc3e429ba146035e97b90/2018_U5/platform010/76ebdda
1717
LIBURING_BASE=/mnt/gvfs/third-party2/liburing/a98e2d137007e3ebf7f33bd6f99c2c56bdaf8488/20210212/platform010/76ebdda
1818
BENCHMARK_BASE=/mnt/gvfs/third-party2/benchmark/780c7a0f9cf0967961e69ad08e61cddd85d61821/trunk/platform010/76ebdda
19-
KERNEL_HEADERS_BASE=/mnt/gvfs/third-party2/kernel-headers/02d9f76aaaba580611cf75e741753c800c7fdc12/fb/platform010/da39a3e
20-
BINUTILS_BASE=/mnt/gvfs/third-party2/binutils/938dc3f064ef3a48c0446f5b11d788d50b3eb5ee/2.37/centos7-native/da39a3e
21-
VALGRIND_BASE=/mnt/gvfs/third-party2/valgrind/429a6b3203eb415f1599bd15183659153129188e/3.15.0/platform010/76ebdda
19+
KERNEL_HEADERS_BASE=/mnt/gvfs/third-party2/kernel-headers/624a2f8f6c93c3c1df8aa4a6255d8202631a6c80/fb/platform010/da39a3e
20+
BINUTILS_BASE=/mnt/gvfs/third-party2/binutils/8dec50d6a10944a2e851f090a3872f9ba0b0b402/2.37/centos9-native/da39a3e
21+
VALGRIND_BASE=/mnt/gvfs/third-party2/valgrind/cd9cc656d49ecb53797ce4d055e49fde29fd57ff/3.19.0/platform010/76ebdda
2222
LUA_BASE=/mnt/gvfs/third-party2/lua/363787fa5cac2a8aa20638909210443278fa138e/5.3.4/platform010/9079c97

build_tools/format-diff.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,21 @@ then
137137
# should be relevant for formatting fixes.
138138
FORMAT_UPSTREAM_MERGE_BASE="$(git merge-base "$FORMAT_UPSTREAM" HEAD)"
139139
# Get the differences
140-
diffs=$(git diff -U0 "$FORMAT_UPSTREAM_MERGE_BASE" | $CLANG_FORMAT_DIFF -p 1)
140+
diffs=$(git diff -U0 "$FORMAT_UPSTREAM_MERGE_BASE" | $CLANG_FORMAT_DIFF -p 1) || true
141141
echo "Checking format of changes not yet in $FORMAT_UPSTREAM..."
142142
else
143143
# Check the format of uncommitted lines,
144-
diffs=$(git diff -U0 HEAD | $CLANG_FORMAT_DIFF -p 1)
144+
diffs=$(git diff -U0 HEAD | $CLANG_FORMAT_DIFF -p 1) || true
145145
echo "Checking format of uncommitted changes..."
146146
fi
147147

148148
if [ -z "$diffs" ]
149149
then
150150
echo "Nothing needs to be reformatted!"
151151
exit 0
152+
elif [ $? -ne 1 ]; then
153+
# CLANG_FORMAT_DIFF will exit on 1 while there is suggested changes.
154+
exit $?
152155
elif [ $CHECK_ONLY ]
153156
then
154157
echo "Your change has unformatted code. Please run make format!"

build_tools/update_dependencies.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ touch "$OUTPUT"
7575
echo "Writing dependencies to $OUTPUT"
7676

7777
# Compilers locations
78-
GCC_BASE=`readlink -f $TP2_LATEST/gcc/11.x/centos7-native/*/`
79-
CLANG_BASE=`readlink -f $TP2_LATEST/llvm-fb/12/platform010/*/`
78+
GCC_BASE=`readlink -f $TP2_LATEST/gcc/11.x/centos9-native/*/`
79+
CLANG_BASE=`readlink -f $TP2_LATEST/llvm-fb/15/platform010/*/`
8080

8181
log_header
8282
log_variable GCC_BASE
@@ -86,7 +86,7 @@ log_variable CLANG_BASE
8686
get_lib_base libgcc 11.x platform010
8787
get_lib_base glibc 2.34 platform010
8888
get_lib_base snappy LATEST platform010
89-
get_lib_base zlib LATEST platform010
89+
get_lib_base zlib 1.2.8 platform010
9090
get_lib_base bzip2 LATEST platform010
9191
get_lib_base lz4 LATEST platform010
9292
get_lib_base zstd LATEST platform010
@@ -99,7 +99,7 @@ get_lib_base liburing LATEST platform010
9999
get_lib_base benchmark LATEST platform010
100100

101101
get_lib_base kernel-headers fb platform010
102-
get_lib_base binutils LATEST centos7-native
102+
get_lib_base binutils LATEST centos9-native
103103
get_lib_base valgrind LATEST platform010
104104
get_lib_base lua 5.3.4 platform010
105105

cache/clock_cache.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void BaseClockTable::TrackAndReleaseEvictedEntry(ClockHandle* h) {
560560
took_value_ownership =
561561
eviction_callback_(ClockCacheShard<FixedHyperClockTable>::ReverseHash(
562562
h->GetHash(), &unhashed, hash_seed_),
563-
reinterpret_cast<Cache::Handle*>(h),
563+
static_cast<Cache::Handle*>(h),
564564
h->meta.LoadRelaxed() & ClockHandle::kHitBitMask);
565565
}
566566
if (!took_value_ownership) {
@@ -1428,19 +1428,19 @@ BaseHyperClockCache<Table>::BaseHyperClockCache(
14281428

14291429
template <class Table>
14301430
Cache::ObjectPtr BaseHyperClockCache<Table>::Value(Handle* handle) {
1431-
return reinterpret_cast<const typename Table::HandleImpl*>(handle)->value;
1431+
return static_cast<const typename Table::HandleImpl*>(handle)->value;
14321432
}
14331433

14341434
template <class Table>
14351435
size_t BaseHyperClockCache<Table>::GetCharge(Handle* handle) const {
1436-
return reinterpret_cast<const typename Table::HandleImpl*>(handle)
1436+
return static_cast<const typename Table::HandleImpl*>(handle)
14371437
->GetTotalCharge();
14381438
}
14391439

14401440
template <class Table>
14411441
const Cache::CacheItemHelper* BaseHyperClockCache<Table>::GetCacheItemHelper(
14421442
Handle* handle) const {
1443-
auto h = reinterpret_cast<const typename Table::HandleImpl*>(handle);
1443+
auto h = static_cast<const typename Table::HandleImpl*>(handle);
14441444
return h->helper;
14451445
}
14461446

cache/clock_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class ClockCacheTest;
298298

299299
// ----------------------------------------------------------------------- //
300300

301-
struct ClockHandleBasicData {
301+
struct ClockHandleBasicData : public Cache::Handle {
302302
Cache::ObjectPtr value = nullptr;
303303
const Cache::CacheItemHelper* helper = nullptr;
304304
// A lossless, reversible hash of the fixed-size (16 byte) cache key. This

cache/compressed_secondary_cache_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ bool CacheUsageWithinBounds(size_t val1, size_t val2, size_t error) {
10621062

10631063
TEST_P(CompressedSecCacheTestWithTiered, CacheReservationManager) {
10641064
CompressedSecondaryCache* sec_cache =
1065-
reinterpret_cast<CompressedSecondaryCache*>(GetSecondaryCache());
1065+
static_cast<CompressedSecondaryCache*>(GetSecondaryCache());
10661066

10671067
// Use EXPECT_PRED3 instead of EXPECT_NEAR to void too many size_t to
10681068
// double explicit casts
@@ -1085,7 +1085,7 @@ TEST_P(CompressedSecCacheTestWithTiered, CacheReservationManager) {
10851085
TEST_P(CompressedSecCacheTestWithTiered,
10861086
CacheReservationManagerMultipleUpdate) {
10871087
CompressedSecondaryCache* sec_cache =
1088-
reinterpret_cast<CompressedSecondaryCache*>(GetSecondaryCache());
1088+
static_cast<CompressedSecondaryCache*>(GetSecondaryCache());
10891089

10901090
EXPECT_PRED3(CacheUsageWithinBounds, GetCache()->GetUsage(), (30 << 20),
10911091
GetPercent(30 << 20, 1));
@@ -1171,7 +1171,7 @@ TEST_P(CompressedSecCacheTestWithTiered, AdmissionPolicy) {
11711171

11721172
TEST_P(CompressedSecCacheTestWithTiered, DynamicUpdate) {
11731173
CompressedSecondaryCache* sec_cache =
1174-
reinterpret_cast<CompressedSecondaryCache*>(GetSecondaryCache());
1174+
static_cast<CompressedSecondaryCache*>(GetSecondaryCache());
11751175
std::shared_ptr<Cache> tiered_cache = GetTieredCache();
11761176

11771177
// Use EXPECT_PRED3 instead of EXPECT_NEAR to void too many size_t to
@@ -1235,7 +1235,7 @@ TEST_P(CompressedSecCacheTestWithTiered, DynamicUpdate) {
12351235

12361236
TEST_P(CompressedSecCacheTestWithTiered, DynamicUpdateWithReservation) {
12371237
CompressedSecondaryCache* sec_cache =
1238-
reinterpret_cast<CompressedSecondaryCache*>(GetSecondaryCache());
1238+
static_cast<CompressedSecondaryCache*>(GetSecondaryCache());
12391239
std::shared_ptr<Cache> tiered_cache = GetTieredCache();
12401240

12411241
ASSERT_OK(cache_res_mgr()->UpdateCacheReservation(10 << 20));
@@ -1329,7 +1329,7 @@ TEST_P(CompressedSecCacheTestWithTiered, DynamicUpdateWithReservation) {
13291329

13301330
TEST_P(CompressedSecCacheTestWithTiered, ReservationOverCapacity) {
13311331
CompressedSecondaryCache* sec_cache =
1332-
reinterpret_cast<CompressedSecondaryCache*>(GetSecondaryCache());
1332+
static_cast<CompressedSecondaryCache*>(GetSecondaryCache());
13331333
std::shared_ptr<Cache> tiered_cache = GetTieredCache();
13341334

13351335
ASSERT_OK(cache_res_mgr()->UpdateCacheReservation(110 << 20));

0 commit comments

Comments
 (0)