mirror of https://github.com/facebook/rocksdb.git
More valgrind fixes (#12990)
Summary: * https://github.com/facebook/rocksdb/issues/12936 was insufficient to fix the std::optional false positives. Making a fix validated in CI this time (see https://github.com/facebook/rocksdb/issues/12991) * valgrind grinds to a halt on startup on my dev machine apparently because it expects internet access. Disable its attempts to access the internet when git is using a proxy. * Move PORTABLE=1 from CI job to the Makefile. Without it, valgrind complains about illegal instructions (too new) Pull Request resolved: https://github.com/facebook/rocksdb/pull/12990 Test Plan: manual, watch nightly valgrind job Reviewed By: ltamasi Differential Revision: D62203242 Pulled By: pdillinger fbshipit-source-id: a611b08da7dbd173b0709ed7feb0578729553a17
This commit is contained in:
parent
0d3aaf7c0f
commit
4577b672d5
|
@ -80,7 +80,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.0
|
- uses: actions/checkout@v4.1.0
|
||||||
- uses: "./.github/actions/pre-steps"
|
- uses: "./.github/actions/pre-steps"
|
||||||
- run: PORTABLE=1 make V=1 -j32 valgrind_test
|
- run: make V=1 -j32 valgrind_test
|
||||||
- uses: "./.github/actions/post-steps"
|
- uses: "./.github/actions/post-steps"
|
||||||
build-windows-vs2022-avx2:
|
build-windows-vs2022-avx2:
|
||||||
if: ${{ github.repository_owner == 'facebook' }}
|
if: ${{ github.repository_owner == 'facebook' }}
|
||||||
|
|
13
Makefile
13
Makefile
|
@ -630,6 +630,11 @@ VALGRIND_VER := $(join $(VALGRIND_VER),valgrind)
|
||||||
VALGRIND_OPTS = --error-exitcode=$(VALGRIND_ERROR) --leak-check=full
|
VALGRIND_OPTS = --error-exitcode=$(VALGRIND_ERROR) --leak-check=full
|
||||||
# Not yet supported: --show-leak-kinds=definite,possible,reachable --errors-for-leak-kinds=definite,possible,reachable
|
# Not yet supported: --show-leak-kinds=definite,possible,reachable --errors-for-leak-kinds=definite,possible,reachable
|
||||||
|
|
||||||
|
# Work around valgrind hanging on systems with limited internet access
|
||||||
|
ifneq ($(shell which git 2>/dev/null && git config --get https.proxy),)
|
||||||
|
export DEBUGINFOD_URLS=
|
||||||
|
endif
|
||||||
|
|
||||||
TEST_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES)) $(GTEST)
|
TEST_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES)) $(GTEST)
|
||||||
BENCH_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(BENCH_LIB_SOURCES))
|
BENCH_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(BENCH_LIB_SOURCES))
|
||||||
CACHE_BENCH_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(CACHE_BENCH_LIB_SOURCES))
|
CACHE_BENCH_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(CACHE_BENCH_LIB_SOURCES))
|
||||||
|
@ -1164,16 +1169,16 @@ ubsan_crash_test_with_best_efforts_recovery: clean
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
|
|
||||||
full_valgrind_test:
|
full_valgrind_test:
|
||||||
ROCKSDB_FULL_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 $(MAKE) valgrind_check
|
ROCKSDB_FULL_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 PORTABLE=1 $(MAKE) valgrind_check
|
||||||
|
|
||||||
full_valgrind_test_some:
|
full_valgrind_test_some:
|
||||||
ROCKSDB_FULL_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 $(MAKE) valgrind_check_some
|
ROCKSDB_FULL_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 PORTABLE=1 $(MAKE) valgrind_check_some
|
||||||
|
|
||||||
valgrind_test:
|
valgrind_test:
|
||||||
ROCKSDB_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 $(MAKE) valgrind_check
|
ROCKSDB_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 PORTABLE=1 $(MAKE) valgrind_check
|
||||||
|
|
||||||
valgrind_test_some:
|
valgrind_test_some:
|
||||||
ROCKSDB_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 $(MAKE) valgrind_check_some
|
ROCKSDB_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 PORTABLE=1 $(MAKE) valgrind_check_some
|
||||||
|
|
||||||
valgrind_check: $(TESTS)
|
valgrind_check: $(TESTS)
|
||||||
$(MAKE) DRIVER="$(VALGRIND_VER) $(VALGRIND_OPTS)" gen_parallel_tests
|
$(MAKE) DRIVER="$(VALGRIND_VER) $(VALGRIND_OPTS)" gen_parallel_tests
|
||||||
|
|
|
@ -91,9 +91,24 @@ class XXPH3FilterBitsBuilder : public BuiltinFilterBitsBuilder {
|
||||||
uint64_t alt_hash = GetSliceHash64(alt);
|
uint64_t alt_hash = GetSliceHash64(alt);
|
||||||
std::optional<uint64_t> prev_key_hash;
|
std::optional<uint64_t> prev_key_hash;
|
||||||
std::optional<uint64_t> prev_alt_hash = hash_entries_info_.prev_alt_hash;
|
std::optional<uint64_t> prev_alt_hash = hash_entries_info_.prev_alt_hash;
|
||||||
|
|
||||||
if (!hash_entries_info_.entries.empty()) {
|
if (!hash_entries_info_.entries.empty()) {
|
||||||
prev_key_hash = hash_entries_info_.entries.back();
|
prev_key_hash = hash_entries_info_.entries.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ROCKSDB_VALGRIND_RUN
|
||||||
|
// Valgrind can report uninitialized FPs on std::optional usage. See e.g.
|
||||||
|
// https://stackoverflow.com/q/51616179
|
||||||
|
if (!prev_key_hash.has_value()) {
|
||||||
|
std::memset((void*)&prev_key_hash, 0, sizeof(prev_key_hash));
|
||||||
|
prev_key_hash.reset();
|
||||||
|
}
|
||||||
|
if (!prev_alt_hash.has_value()) {
|
||||||
|
std::memset((void*)&prev_alt_hash, 0, sizeof(prev_key_hash));
|
||||||
|
prev_alt_hash.reset();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Add alt first, so that entries.back() always contains previous key
|
// Add alt first, so that entries.back() always contains previous key
|
||||||
// ASSUMING a change from one alt to the next implies a change to
|
// ASSUMING a change from one alt to the next implies a change to
|
||||||
// corresponding key
|
// corresponding key
|
||||||
|
@ -295,15 +310,6 @@ class XXPH3FilterBitsBuilder : public BuiltinFilterBitsBuilder {
|
||||||
bool detect_filter_construct_corruption_;
|
bool detect_filter_construct_corruption_;
|
||||||
|
|
||||||
struct HashEntriesInfo {
|
struct HashEntriesInfo {
|
||||||
#ifdef ROCKSDB_VALGRIND_RUN
|
|
||||||
HashEntriesInfo() {
|
|
||||||
// Valgrind can report uninitialized FPs on std::optional usage. See e.g.
|
|
||||||
// https://stackoverflow.com/q/51616179
|
|
||||||
std::memset((void*)&prev_alt_hash, 0, sizeof(prev_alt_hash));
|
|
||||||
prev_alt_hash = {};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// A deque avoids unnecessary copying of already-saved values
|
// A deque avoids unnecessary copying of already-saved values
|
||||||
// and has near-minimal peak memory use.
|
// and has near-minimal peak memory use.
|
||||||
std::deque<uint64_t> entries;
|
std::deque<uint64_t> entries;
|
||||||
|
|
Loading…
Reference in New Issue