mirror of
https://github.com/facebook/rocksdb.git
synced 2026-11-06 02:52:35 -05:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a43615041 | ||
|
|
af72046d14 | ||
|
|
501f359dd1 | ||
|
|
fc1df4c688 | ||
|
|
3b6ac67f13 | ||
|
|
d3dbed0e96 | ||
|
|
f8741f1f3b |
No files matched your search
+5
-1
@@ -1,5 +1,9 @@
|
||||
# Rocksdb Change Log
|
||||
## Unreleased
|
||||
## 8.1.1 (04/06/2023)
|
||||
### Bug Fixes
|
||||
* In the DB::VerifyFileChecksums API, ensure that file system reads of SST files are equal to the readahead_size in ReadOptions, if specified. Previously, each read was 2x the readahead_size.
|
||||
|
||||
## 8.1.0 (03/18/2023)
|
||||
### Behavior changes
|
||||
* Compaction output file cutting logic now considers range tombstone start keys. For example, SST partitioner now may receive ParitionRequest for range tombstone start keys.
|
||||
* If the async_io ReadOption is specified for MultiGet or NewIterator on a platform that doesn't support IO uring, the option is ignored and synchronous IO is used.
|
||||
|
||||
@@ -63,13 +63,7 @@ if [ -z "$ROCKSDB_NO_FBCODE" -a -d /mnt/gvfs/third-party ]; then
|
||||
if [ "$LIB_MODE" == "shared" ]; then
|
||||
PIC_BUILD=1
|
||||
fi
|
||||
if [ -n "$ROCKSDB_FBCODE_BUILD_WITH_PLATFORM010" ]; then
|
||||
source "$PWD/build_tools/fbcode_config_platform010.sh"
|
||||
elif [ -n "$ROCKSDB_FBCODE_BUILD_WITH_PLATFORM009" ]; then
|
||||
source "$PWD/build_tools/fbcode_config_platform009.sh"
|
||||
else
|
||||
source "$PWD/build_tools/fbcode_config_platform009.sh"
|
||||
fi
|
||||
source "$PWD/build_tools/fbcode_config_platform010.sh"
|
||||
fi
|
||||
|
||||
# Delete existing output, if it exists
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
GCC_BASE=/mnt/gvfs/third-party2/gcc/1795efe5f06778c15a92c8f9a2aba5dc496d9d4d/9.x/centos7-native/3bed279
|
||||
CLANG_BASE=/mnt/gvfs/third-party2/llvm-fb/7318eaac22659b6ff2fe43918e4b69fd0772a8a7/9.0.0/platform009/651ee30
|
||||
LIBGCC_BASE=/mnt/gvfs/third-party2/libgcc/4959b39cfbe5965a37c861c4c327fa7c5c759b87/9.x/platform009/9202ce7
|
||||
GLIBC_BASE=/mnt/gvfs/third-party2/glibc/45ce3375cdc77ecb2520bbf8f0ecddd3f98efd7a/2.30/platform009/f259413
|
||||
SNAPPY_BASE=/mnt/gvfs/third-party2/snappy/be4de3205e029101b18aa8103daa696c2bef3b19/1.1.3/platform009/7f3b187
|
||||
ZLIB_BASE=/mnt/gvfs/third-party2/zlib/3c160ac5c67e257501e24c6c1d00ad5e01d73db6/1.2.8/platform009/7f3b187
|
||||
BZIP2_BASE=/mnt/gvfs/third-party2/bzip2/73a237ac5bc0a5f5d67b39b8d253cfebaab88684/1.0.6/platform009/7f3b187
|
||||
LZ4_BASE=/mnt/gvfs/third-party2/lz4/6ca38d3c390be2774d61a300f151464bbd632d62/1.9.1/platform009/7f3b187
|
||||
ZSTD_BASE=/mnt/gvfs/third-party2/zstd/64c58a207d2495e83abc57a500a956df09b79a7c/1.4.x/platform009/ba86d1f
|
||||
GFLAGS_BASE=/mnt/gvfs/third-party2/gflags/824d0a8a5abb5b121afd1b35fc3896407ea50092/2.2.0/platform009/7f3b187
|
||||
JEMALLOC_BASE=/mnt/gvfs/third-party2/jemalloc/b62912d333ef33f9760efa6219dbe3fe6abb3b0e/master/platform009/c305944
|
||||
NUMA_BASE=/mnt/gvfs/third-party2/numa/0af65f71e23a67bf65dc91b11f95caa39325c432/2.0.11/platform009/7f3b187
|
||||
LIBUNWIND_BASE=/mnt/gvfs/third-party2/libunwind/02486dac347645d31dce116f44e1de3177315be2/1.4/platform009/5191652
|
||||
TBB_BASE=/mnt/gvfs/third-party2/tbb/2e0ec671e550bfca347300bf3f789d9c0fff24ad/2018_U5/platform009/7f3b187
|
||||
LIBURING_BASE=/mnt/gvfs/third-party2/liburing/70dbd9cfee63a25611417d09433a86d7711b3990/20200729/platform009/7f3b187
|
||||
KERNEL_HEADERS_BASE=/mnt/gvfs/third-party2/kernel-headers/32b8a2407b634df3f8f948ba373fc4acc6a18296/fb/platform009/da39a3e
|
||||
BINUTILS_BASE=/mnt/gvfs/third-party2/binutils/08634589372fa5f237bfd374e8c644a8364e78c1/2.32/platform009/ba86d1f/
|
||||
VALGRIND_BASE=/mnt/gvfs/third-party2/valgrind/6ae525939ad02e5e676855082fbbc7828dbafeac/3.15.0/platform009/7f3b187
|
||||
LUA_BASE=/mnt/gvfs/third-party2/lua/162efd9561a3d21f6869f4814011e9cf1b3ff4dc/5.3.4/platform009/a6271c4
|
||||
BENCHMARK_BASE=/mnt/gvfs/third-party2/benchmark/30bf49ad6414325e17f3425b0edcb64239427ae3/1.6.1/platform009/7f3b187
|
||||
GLOG_BASE=/mnt/gvfs/third-party2/glog/32d751bd5673375b438158717ab6a57c1cc57e3d/0.3.2_fb/platform009/10a364d
|
||||
@@ -1,170 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
#
|
||||
# Set environment variables so that we can compile rocksdb using
|
||||
# fbcode settings. It uses the latest g++ and clang compilers and also
|
||||
# uses jemalloc
|
||||
# Environment variables that change the behavior of this script:
|
||||
# PIC_BUILD -- if true, it will only take pic versions of libraries from fbcode. libraries that don't have pic variant will not be included
|
||||
|
||||
|
||||
BASEDIR=`dirname $BASH_SOURCE`
|
||||
source "$BASEDIR/dependencies_platform009.sh"
|
||||
|
||||
CFLAGS=""
|
||||
|
||||
# libgcc
|
||||
LIBGCC_INCLUDE="$LIBGCC_BASE/include/c++/9.3.0 -I $LIBGCC_BASE/include/c++/9.3.0/backward"
|
||||
LIBGCC_LIBS=" -L $LIBGCC_BASE/lib"
|
||||
|
||||
# glibc
|
||||
GLIBC_INCLUDE="$GLIBC_BASE/include"
|
||||
GLIBC_LIBS=" -L $GLIBC_BASE/lib"
|
||||
|
||||
if test -z $PIC_BUILD; then
|
||||
MAYBE_PIC=
|
||||
else
|
||||
MAYBE_PIC=_pic
|
||||
fi
|
||||
|
||||
if ! test $ROCKSDB_DISABLE_SNAPPY; then
|
||||
# snappy
|
||||
SNAPPY_INCLUDE=" -I $SNAPPY_BASE/include/"
|
||||
SNAPPY_LIBS=" $SNAPPY_BASE/lib/libsnappy${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DSNAPPY"
|
||||
fi
|
||||
|
||||
if ! test $ROCKSDB_DISABLE_ZLIB; then
|
||||
# location of zlib headers and libraries
|
||||
ZLIB_INCLUDE=" -I $ZLIB_BASE/include/"
|
||||
ZLIB_LIBS=" $ZLIB_BASE/lib/libz${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DZLIB"
|
||||
fi
|
||||
|
||||
if ! test $ROCKSDB_DISABLE_BZIP; then
|
||||
# location of bzip headers and libraries
|
||||
BZIP_INCLUDE=" -I $BZIP2_BASE/include/"
|
||||
BZIP_LIBS=" $BZIP2_BASE/lib/libbz2${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DBZIP2"
|
||||
fi
|
||||
|
||||
if ! test $ROCKSDB_DISABLE_LZ4; then
|
||||
LZ4_INCLUDE=" -I $LZ4_BASE/include/"
|
||||
LZ4_LIBS=" $LZ4_BASE/lib/liblz4${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DLZ4"
|
||||
fi
|
||||
|
||||
if ! test $ROCKSDB_DISABLE_ZSTD; then
|
||||
ZSTD_INCLUDE=" -I $ZSTD_BASE/include/"
|
||||
ZSTD_LIBS=" $ZSTD_BASE/lib/libzstd${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DZSTD"
|
||||
fi
|
||||
|
||||
# location of gflags headers and libraries
|
||||
GFLAGS_INCLUDE=" -I $GFLAGS_BASE/include/"
|
||||
GFLAGS_LIBS=" $GFLAGS_BASE/lib/libgflags${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DGFLAGS=gflags"
|
||||
|
||||
BENCHMARK_INCLUDE=" -I $BENCHMARK_BASE/include/"
|
||||
BENCHMARK_LIBS=" $BENCHMARK_BASE/lib/libbenchmark${MAYBE_PIC}.a"
|
||||
|
||||
GLOG_INCLUDE=" -I $GLOG_BASE/include/"
|
||||
GLOG_LIBS=" $GLOG_BASE/lib/libglog${MAYBE_PIC}.a"
|
||||
|
||||
# location of jemalloc
|
||||
JEMALLOC_INCLUDE=" -I $JEMALLOC_BASE/include/"
|
||||
JEMALLOC_LIB=" $JEMALLOC_BASE/lib/libjemalloc${MAYBE_PIC}.a"
|
||||
|
||||
# location of numa
|
||||
NUMA_INCLUDE=" -I $NUMA_BASE/include/"
|
||||
NUMA_LIB=" $NUMA_BASE/lib/libnuma${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DNUMA"
|
||||
|
||||
# location of libunwind
|
||||
LIBUNWIND="$LIBUNWIND_BASE/lib/libunwind${MAYBE_PIC}.a"
|
||||
|
||||
# location of TBB
|
||||
TBB_INCLUDE=" -isystem $TBB_BASE/include/"
|
||||
TBB_LIBS="$TBB_BASE/lib/libtbb${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DTBB"
|
||||
|
||||
# location of LIBURING
|
||||
LIBURING_INCLUDE=" -isystem $LIBURING_BASE/include/"
|
||||
LIBURING_LIBS="$LIBURING_BASE/lib/liburing${MAYBE_PIC}.a"
|
||||
CFLAGS+=" -DLIBURING"
|
||||
|
||||
test "$USE_SSE" || USE_SSE=1
|
||||
export USE_SSE
|
||||
test "$PORTABLE" || PORTABLE=1
|
||||
export PORTABLE
|
||||
|
||||
BINUTILS="$BINUTILS_BASE/bin"
|
||||
AR="$BINUTILS/ar"
|
||||
AS="$BINUTILS/as"
|
||||
|
||||
DEPS_INCLUDE="$SNAPPY_INCLUDE $ZLIB_INCLUDE $BZIP_INCLUDE $LZ4_INCLUDE $ZSTD_INCLUDE $GFLAGS_INCLUDE $NUMA_INCLUDE $TBB_INCLUDE $LIBURING_INCLUDE $BENCHMARK_INCLUDE $GLOG_INCLUDE"
|
||||
|
||||
STDLIBS="-L $GCC_BASE/lib64"
|
||||
|
||||
CLANG_BIN="$CLANG_BASE/bin"
|
||||
CLANG_LIB="$CLANG_BASE/lib"
|
||||
CLANG_SRC="$CLANG_BASE/../../src"
|
||||
|
||||
CLANG_ANALYZER="$CLANG_BIN/clang++"
|
||||
CLANG_SCAN_BUILD="$CLANG_SRC/llvm/clang/tools/scan-build/bin/scan-build"
|
||||
|
||||
if [ -z "$USE_CLANG" ]; then
|
||||
# gcc
|
||||
CC="$GCC_BASE/bin/gcc"
|
||||
CXX="$GCC_BASE/bin/g++"
|
||||
AR="$GCC_BASE/bin/gcc-ar"
|
||||
|
||||
CFLAGS+=" -B$BINUTILS"
|
||||
CFLAGS+=" -isystem $LIBGCC_INCLUDE"
|
||||
CFLAGS+=" -isystem $GLIBC_INCLUDE"
|
||||
JEMALLOC=1
|
||||
else
|
||||
# clang
|
||||
CLANG_INCLUDE="$CLANG_LIB/clang/stable/include"
|
||||
CC="$CLANG_BIN/clang"
|
||||
CXX="$CLANG_BIN/clang++"
|
||||
AR="$CLANG_BIN/llvm-ar"
|
||||
|
||||
KERNEL_HEADERS_INCLUDE="$KERNEL_HEADERS_BASE/include"
|
||||
|
||||
CFLAGS+=" -B$BINUTILS -nostdinc -nostdlib"
|
||||
CFLAGS+=" -isystem $LIBGCC_BASE/include/c++/9.x "
|
||||
CFLAGS+=" -isystem $LIBGCC_BASE/include/c++/9.x/x86_64-facebook-linux "
|
||||
CFLAGS+=" -isystem $GLIBC_INCLUDE"
|
||||
CFLAGS+=" -isystem $LIBGCC_INCLUDE"
|
||||
CFLAGS+=" -isystem $CLANG_INCLUDE"
|
||||
CFLAGS+=" -isystem $KERNEL_HEADERS_INCLUDE/linux "
|
||||
CFLAGS+=" -isystem $KERNEL_HEADERS_INCLUDE "
|
||||
CFLAGS+=" -Wno-expansion-to-defined "
|
||||
CXXFLAGS="-nostdinc++"
|
||||
fi
|
||||
|
||||
CFLAGS+=" $DEPS_INCLUDE"
|
||||
CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DHAVE_SSE42 -DROCKSDB_IOURING_PRESENT"
|
||||
CXXFLAGS+=" $CFLAGS"
|
||||
|
||||
EXEC_LDFLAGS=" $SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $ZSTD_LIBS $GFLAGS_LIBS $NUMA_LIB $TBB_LIBS $LIBURING_LIBS $BENCHMARK_LIBS"
|
||||
EXEC_LDFLAGS+=" -Wl,--dynamic-linker,/usr/local/fbcode/platform009/lib/ld.so"
|
||||
EXEC_LDFLAGS+=" $LIBUNWIND"
|
||||
EXEC_LDFLAGS+=" -Wl,-rpath=/usr/local/fbcode/platform009/lib"
|
||||
EXEC_LDFLAGS+=" -Wl,-rpath=$GCC_BASE/lib64"
|
||||
# required by libtbb
|
||||
EXEC_LDFLAGS+=" -ldl"
|
||||
|
||||
PLATFORM_LDFLAGS="$LIBGCC_LIBS $GLIBC_LIBS $STDLIBS -lgcc -lstdc++"
|
||||
PLATFORM_LDFLAGS+=" -B$BINUTILS"
|
||||
|
||||
EXEC_LDFLAGS_SHARED="$SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $ZSTD_LIBS $GFLAGS_LIBS $TBB_LIBS $LIBURING_LIBS $BENCHMARK_LIBS"
|
||||
|
||||
VALGRIND_VER="$VALGRIND_BASE/bin/"
|
||||
|
||||
# lua not supported because it's on track for deprecation, I think
|
||||
LUA_PATH=
|
||||
LUA_LIB=
|
||||
|
||||
export CC CXX AR AS CFLAGS CXXFLAGS EXEC_LDFLAGS EXEC_LDFLAGS_SHARED VALGRIND_VER JEMALLOC_LIB JEMALLOC_INCLUDE CLANG_ANALYZER CLANG_SCAN_BUILD LUA_PATH LUA_LIB
|
||||
@@ -360,7 +360,7 @@ function send_to_ods {
|
||||
echo >&2 "ERROR: Key $key doesn't have a value."
|
||||
return
|
||||
fi
|
||||
curl --silent "https://www.intern.facebook.com/intern/agent/ods_set.php?entity=rocksdb_build&key=$key&value=$value" \
|
||||
curl --silent "https://www.facebook.com/intern/agent/ods_set.php?entity=rocksdb_build&key=$key&value=$value" \
|
||||
--connect-timeout 60
|
||||
}
|
||||
|
||||
|
||||
@@ -104,46 +104,3 @@ get_lib_base valgrind LATEST platform010
|
||||
get_lib_base lua 5.3.4 platform010
|
||||
|
||||
git diff $OUTPUT
|
||||
|
||||
|
||||
###########################################################
|
||||
# platform009 dependencies #
|
||||
###########################################################
|
||||
|
||||
OUTPUT="$BASEDIR/dependencies_platform009.sh"
|
||||
|
||||
rm -f "$OUTPUT"
|
||||
touch "$OUTPUT"
|
||||
|
||||
echo "Writing dependencies to $OUTPUT"
|
||||
|
||||
# Compilers locations
|
||||
GCC_BASE=`readlink -f $TP2_LATEST/gcc/9.x/centos7-native/*/`
|
||||
CLANG_BASE=`readlink -f $TP2_LATEST/llvm-fb/9.0.0/platform009/*/`
|
||||
|
||||
log_header
|
||||
log_variable GCC_BASE
|
||||
log_variable CLANG_BASE
|
||||
|
||||
# Libraries locations
|
||||
get_lib_base libgcc 9.x platform009
|
||||
get_lib_base glibc 2.30 platform009
|
||||
get_lib_base snappy LATEST platform009
|
||||
get_lib_base zlib LATEST platform009
|
||||
get_lib_base bzip2 LATEST platform009
|
||||
get_lib_base lz4 LATEST platform009
|
||||
get_lib_base zstd LATEST platform009
|
||||
get_lib_base gflags LATEST platform009
|
||||
get_lib_base jemalloc LATEST platform009
|
||||
get_lib_base numa LATEST platform009
|
||||
get_lib_base libunwind LATEST platform009
|
||||
get_lib_base tbb 2018_U5 platform009
|
||||
get_lib_base liburing LATEST platform009
|
||||
get_lib_base benchmark LATEST platform009
|
||||
|
||||
get_lib_base kernel-headers fb platform009
|
||||
get_lib_base binutils LATEST centos7-native
|
||||
get_lib_base valgrind LATEST platform009
|
||||
get_lib_base lua 5.3.4 platform009
|
||||
|
||||
git diff $OUTPUT
|
||||
@@ -12,7 +12,7 @@ fi
|
||||
ROOT=".."
|
||||
# Fetch right version of gcov
|
||||
if [ -d /mnt/gvfs/third-party -a -z "$CXX" ]; then
|
||||
source $ROOT/build_tools/fbcode_config_platform009.sh
|
||||
source $ROOT/build_tools/fbcode_config_platform010.sh
|
||||
GCOV=$GCC_BASE/bin/gcov
|
||||
else
|
||||
GCOV=$(which gcov)
|
||||
|
||||
@@ -4494,6 +4494,63 @@ TEST_F(DBBasicTest, VerifyFileChecksums) {
|
||||
ASSERT_TRUE(db_->VerifyFileChecksums(ReadOptions()).IsInvalidArgument());
|
||||
}
|
||||
|
||||
TEST_F(DBBasicTest, VerifyFileChecksumsReadahead) {
|
||||
Options options = GetDefaultOptions();
|
||||
options.create_if_missing = true;
|
||||
options.env = env_;
|
||||
options.file_checksum_gen_factory = GetFileChecksumGenCrc32cFactory();
|
||||
DestroyAndReopen(options);
|
||||
|
||||
Random rnd(301);
|
||||
int alignment = 256 * 1024;
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
ASSERT_OK(Put("key" + std::to_string(i), rnd.RandomString(alignment)));
|
||||
}
|
||||
ASSERT_OK(Flush());
|
||||
|
||||
std::vector<std::string> filenames;
|
||||
int sst_cnt = 0;
|
||||
std::string sst_name;
|
||||
uint64_t sst_size;
|
||||
uint64_t number;
|
||||
FileType type;
|
||||
ASSERT_OK(env_->GetChildren(dbname_, &filenames));
|
||||
for (auto name : filenames) {
|
||||
if (ParseFileName(name, &number, &type)) {
|
||||
if (type == kTableFile) {
|
||||
sst_cnt++;
|
||||
sst_name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(sst_cnt, 1);
|
||||
ASSERT_OK(env_->GetFileSize(dbname_ + '/' + sst_name, &sst_size));
|
||||
|
||||
bool last_read = false;
|
||||
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
||||
"GenerateOneFileChecksum::Chunk:0", [&](void* /*arg*/) {
|
||||
if (env_->random_read_bytes_counter_.load() == sst_size) {
|
||||
EXPECT_FALSE(last_read);
|
||||
last_read = true;
|
||||
} else {
|
||||
ASSERT_EQ(env_->random_read_bytes_counter_.load() & (alignment - 1),
|
||||
0);
|
||||
}
|
||||
});
|
||||
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
||||
env_->count_random_reads_ = true;
|
||||
env_->random_read_bytes_counter_ = 0;
|
||||
env_->random_read_counter_.Reset();
|
||||
|
||||
ReadOptions ro;
|
||||
ro.readahead_size = alignment;
|
||||
ASSERT_OK(db_->VerifyFileChecksums(ro));
|
||||
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
||||
ASSERT_TRUE(last_read);
|
||||
ASSERT_EQ(env_->random_read_counter_.Read(),
|
||||
(sst_size + alignment - 1) / (alignment));
|
||||
}
|
||||
|
||||
// TODO: re-enable after we provide finer-grained control for WAL tracking to
|
||||
// meet the needs of different use cases, durability levels and recovery modes.
|
||||
TEST_F(DBBasicTest, DISABLED_ManualWalSync) {
|
||||
|
||||
@@ -2109,25 +2109,26 @@ TEST_F(DBPropertiesTest, GetMapPropertyBlockCacheEntryStats) {
|
||||
|
||||
TEST_F(DBPropertiesTest, WriteStallStatsSanityCheck) {
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(WriteStallCause::kNone); ++i) {
|
||||
std::string str = kWriteStallCauseToHyphenString[i];
|
||||
WriteStallCause cause = static_cast<WriteStallCause>(i);
|
||||
const std::string& str = WriteStallCauseToHyphenString(cause);
|
||||
ASSERT_TRUE(!str.empty())
|
||||
<< "Please ensure mapping from `WriteStallCause` to "
|
||||
"`kWriteStallCauseToHyphenString` is complete";
|
||||
WriteStallCause cause = static_cast<WriteStallCause>(i);
|
||||
"`WriteStallCauseToHyphenString` is complete";
|
||||
if (cause == WriteStallCause::kCFScopeWriteStallCauseEnumMax ||
|
||||
cause == WriteStallCause::kDBScopeWriteStallCauseEnumMax) {
|
||||
ASSERT_EQ(str, kInvalidWriteStallCauseHyphenString)
|
||||
<< "Please ensure order in `kWriteStallCauseToHyphenString` is "
|
||||
ASSERT_EQ(str, InvalidWriteStallHyphenString())
|
||||
<< "Please ensure order in `WriteStallCauseToHyphenString` is "
|
||||
"consistent with `WriteStallCause`";
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(WriteStallCondition::kNormal);
|
||||
++i) {
|
||||
std::string str = kWriteStallConditionToHyphenString[i];
|
||||
WriteStallCondition condition = static_cast<WriteStallCondition>(i);
|
||||
const std::string& str = WriteStallConditionToHyphenString(condition);
|
||||
ASSERT_TRUE(!str.empty())
|
||||
<< "Please ensure mapping from `WriteStallCondition` to "
|
||||
"`kWriteStallConditionToHyphenString` is complete";
|
||||
"`WriteStallConditionToHyphenString` is complete";
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(WriteStallCause::kNone); ++i) {
|
||||
|
||||
+40
-20
@@ -6,26 +6,46 @@
|
||||
#include "db/write_stall_stats.h"
|
||||
|
||||
namespace ROCKSDB_NAMESPACE {
|
||||
const std::string kInvalidWriteStallCauseHyphenString = "invalid";
|
||||
const std::string& InvalidWriteStallHyphenString() {
|
||||
static const std::string kInvalidWriteStallHyphenString = "invalid";
|
||||
return kInvalidWriteStallHyphenString;
|
||||
}
|
||||
|
||||
const std::array<std::string, static_cast<uint32_t>(WriteStallCause::kNone)>
|
||||
kWriteStallCauseToHyphenString{{
|
||||
"memtable-limit",
|
||||
"l0-file-count-limit",
|
||||
"pending-compaction-bytes",
|
||||
// WriteStallCause::kCFScopeWriteStallCauseEnumMax
|
||||
kInvalidWriteStallCauseHyphenString,
|
||||
"write-buffer-manager-limit",
|
||||
// WriteStallCause::kDBScopeWriteStallCauseEnumMax
|
||||
kInvalidWriteStallCauseHyphenString,
|
||||
}};
|
||||
const std::string& WriteStallCauseToHyphenString(WriteStallCause cause) {
|
||||
static const std::string kMemtableLimit = "memtable-limit";
|
||||
static const std::string kL0FileCountLimit = "l0-file-count-limit";
|
||||
static const std::string kPendingCompactionBytes = "pending-compaction-bytes";
|
||||
static const std::string kWriteBufferManagerLimit =
|
||||
"write-buffer-manager-limit";
|
||||
switch (cause) {
|
||||
case WriteStallCause::kMemtableLimit:
|
||||
return kMemtableLimit;
|
||||
case WriteStallCause::kL0FileCountLimit:
|
||||
return kL0FileCountLimit;
|
||||
case WriteStallCause::kPendingCompactionBytes:
|
||||
return kPendingCompactionBytes;
|
||||
case WriteStallCause::kWriteBufferManagerLimit:
|
||||
return kWriteBufferManagerLimit;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return InvalidWriteStallHyphenString();
|
||||
}
|
||||
|
||||
const std::array<std::string,
|
||||
static_cast<uint32_t>(WriteStallCondition::kNormal)>
|
||||
kWriteStallConditionToHyphenString{{
|
||||
"delays",
|
||||
"stops",
|
||||
}};
|
||||
const std::string& WriteStallConditionToHyphenString(
|
||||
WriteStallCondition condition) {
|
||||
static const std::string kDelayed = "delays";
|
||||
static const std::string kStopped = "stops";
|
||||
switch (condition) {
|
||||
case WriteStallCondition::kDelayed:
|
||||
return kDelayed;
|
||||
case WriteStallCondition::kStopped:
|
||||
return kStopped;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return InvalidWriteStallHyphenString();
|
||||
}
|
||||
|
||||
InternalStats::InternalCFStatsType InternalCFStat(
|
||||
WriteStallCause cause, WriteStallCondition condition) {
|
||||
@@ -139,14 +159,14 @@ std::string WriteStallStatsMapKeys::CauseConditionCount(
|
||||
|
||||
std::string cause_name;
|
||||
if (isCFScopeWriteStallCause(cause) || isDBScopeWriteStallCause(cause)) {
|
||||
cause_name = kWriteStallCauseToHyphenString[static_cast<uint32_t>(cause)];
|
||||
cause_name = WriteStallCauseToHyphenString(cause);
|
||||
} else {
|
||||
assert(false);
|
||||
return "";
|
||||
}
|
||||
|
||||
const std::string& condition_name =
|
||||
kWriteStallConditionToHyphenString[static_cast<uint32_t>(condition)];
|
||||
WriteStallConditionToHyphenString(condition);
|
||||
|
||||
cause_condition_count_name.reserve(cause_name.size() + 1 +
|
||||
condition_name.size());
|
||||
|
||||
@@ -11,15 +11,12 @@
|
||||
#include "rocksdb/types.h"
|
||||
|
||||
namespace ROCKSDB_NAMESPACE {
|
||||
extern const std::string kInvalidWriteStallCauseHyphenString;
|
||||
extern const std::string& InvalidWriteStallHyphenString();
|
||||
|
||||
extern const std::array<std::string,
|
||||
static_cast<uint32_t>(WriteStallCause::kNone)>
|
||||
kWriteStallCauseToHyphenString;
|
||||
extern const std::string& WriteStallCauseToHyphenString(WriteStallCause cause);
|
||||
|
||||
extern const std::array<std::string,
|
||||
static_cast<uint32_t>(WriteStallCondition::kNormal)>
|
||||
kWriteStallConditionToHyphenString;
|
||||
extern const std::string& WriteStallConditionToHyphenString(
|
||||
WriteStallCondition condition);
|
||||
|
||||
// REQUIRES:
|
||||
// cause` is CF-scope `WriteStallCause`, see `WriteStallCause` for more
|
||||
|
||||
+14
-10
@@ -135,7 +135,7 @@ IOStatus GenerateOneFileChecksum(
|
||||
FileChecksumGenFactory* checksum_factory,
|
||||
const std::string& requested_checksum_func_name, std::string* file_checksum,
|
||||
std::string* file_checksum_func_name,
|
||||
size_t verify_checksums_readahead_size, bool allow_mmap_reads,
|
||||
size_t verify_checksums_readahead_size, bool /*allow_mmap_reads*/,
|
||||
std::shared_ptr<IOTracer>& io_tracer, RateLimiter* rate_limiter,
|
||||
Env::IOPriority rate_limiter_priority) {
|
||||
if (checksum_factory == nullptr) {
|
||||
@@ -196,10 +196,12 @@ IOStatus GenerateOneFileChecksum(
|
||||
size_t readahead_size = (verify_checksums_readahead_size != 0)
|
||||
? verify_checksums_readahead_size
|
||||
: default_max_read_ahead_size;
|
||||
|
||||
FilePrefetchBuffer prefetch_buffer(readahead_size /* readahead_size */,
|
||||
readahead_size /* max_readahead_size */,
|
||||
!allow_mmap_reads /* enable */);
|
||||
std::unique_ptr<char[]> buf;
|
||||
if (reader->use_direct_io()) {
|
||||
size_t alignment = reader->file()->GetRequiredBufferAlignment();
|
||||
readahead_size = (readahead_size + alignment - 1) & ~(alignment - 1);
|
||||
}
|
||||
buf.reset(new char[readahead_size]);
|
||||
|
||||
Slice slice;
|
||||
uint64_t offset = 0;
|
||||
@@ -207,11 +209,11 @@ IOStatus GenerateOneFileChecksum(
|
||||
while (size > 0) {
|
||||
size_t bytes_to_read =
|
||||
static_cast<size_t>(std::min(uint64_t{readahead_size}, size));
|
||||
if (!prefetch_buffer.TryReadFromCache(
|
||||
opts, reader.get(), offset, bytes_to_read, &slice,
|
||||
nullptr /* status */, rate_limiter_priority,
|
||||
false /* for_compaction */)) {
|
||||
return IOStatus::Corruption("file read failed");
|
||||
io_s = reader->Read(opts, offset, bytes_to_read, &slice, buf.get(), nullptr,
|
||||
rate_limiter_priority);
|
||||
if (!io_s.ok()) {
|
||||
return IOStatus::Corruption("file read failed with error: " +
|
||||
io_s.ToString());
|
||||
}
|
||||
if (slice.size() == 0) {
|
||||
return IOStatus::Corruption("file too small");
|
||||
@@ -219,6 +221,8 @@ IOStatus GenerateOneFileChecksum(
|
||||
checksum_generator->Update(slice.data(), slice.size());
|
||||
size -= slice.size();
|
||||
offset += slice.size();
|
||||
|
||||
TEST_SYNC_POINT("GenerateOneFileChecksum::Chunk:0");
|
||||
}
|
||||
checksum_generator->Finalize();
|
||||
*file_checksum = checksum_generator->GetChecksum();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// minor or major version number planned for release.
|
||||
#define ROCKSDB_MAJOR 8
|
||||
#define ROCKSDB_MINOR 1
|
||||
#define ROCKSDB_PATCH 0
|
||||
#define ROCKSDB_PATCH 1
|
||||
|
||||
// Do not use these. We made the mistake of declaring macros starting with
|
||||
// double underscore. Now we have to live with our choice. We'll deprecate these
|
||||
|
||||
Reference in new issue
Block a user