Update helio (#2538)

chore: UpdateHelio dependency

Add support for asan/ubsan checkers in our dev environment.
Remove more clang warnings.

Once we fix all the problems we will enable them in our CI as well.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-02-06 11:57:26 +02:00 committed by GitHub
parent 4c0055ddf0
commit 336d6ff181
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 74 additions and 51 deletions

View file

@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2
- uses: actions/setup-python@v3 - uses: actions/setup-python@v5
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install pre-commit python -m pip install pre-commit
@ -53,20 +53,32 @@ jobs:
container: container:
image: ghcr.io/romange/${{ matrix.container }} image: ghcr.io/romange/${{ matrix.container }}
volumes:
- /:/hostroot
credentials: credentials:
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Install dependencies - name: Prepare Environment
run: | run: |
uname -a uname -a
cmake --version cmake --version
mkdir -p ${GITHUB_WORKSPACE}/build mkdir -p ${GITHUB_WORKSPACE}/build
echo "===================Before freeing up space ============================================"
df -h
rm -rf /hostroot/usr/share/dotnet
rm -rf /hostroot/usr/local/share/boost
rm -rf /hostroot/usr/local/lib/android
rm -rf /hostroot/opt/ghc
echo "===================After freeing up space ============================================"
df -h
- name: Run sccache-cache - name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3 uses: mozilla-actions/sccache-action@v0.0.3
@ -94,9 +106,15 @@ jobs:
- name: Build - name: Build
run: | run: |
cd ${GITHUB_WORKSPACE}/build cd ${GITHUB_WORKSPACE}/build
ninja search_family_test
df -h
echo "-----------------------------"
ninja src/all ninja src/all
${SCCACHE_PATH} --show-stats | tee $GITHUB_STEP_SUMMARY - name: PostFail
if: failure()
run: |
echo "disk space is:"
df -h
- name: C++ Unit Tests - name: C++ Unit Tests
run: | run: |
cd ${GITHUB_WORKSPACE}/build cd ${GITHUB_WORKSPACE}/build

View file

@ -35,12 +35,12 @@ option(DF_USE_SSL "Provide support for SSL connections" ON)
find_package(OpenSSL) find_package(OpenSSL)
if (SUPPORT_ASAN) if (SUPPORT_ASAN AND NOT DEFINED ENV{CI})
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
endif() endif()
if (SUPPORT_USAN) if (SUPPORT_USAN AND NOT DEFINED ENV{CI})
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined")
endif() endif()
include(third_party) include(third_party)

2
helio

@ -1 +1 @@
Subproject commit 6b3c2c5d249ccb0f64da80d168bc35c574724fb4 Subproject commit d19d64699e7d23e6fa0a63614cda49f17eaa04d8

View file

@ -35,14 +35,6 @@ constexpr uint64_t kInfTag = 1ULL << 63;
constexpr uint64_t kIgnoreDoubleTag = 1ULL << 62; constexpr uint64_t kIgnoreDoubleTag = 1ULL << 62;
constexpr uint64_t kSdsMask = (1ULL << 60) - 1; constexpr uint64_t kSdsMask = (1ULL << 60) - 1;
inline zskiplistNode* Next(bool reverse, zskiplistNode* ln) {
return reverse ? ln->backward : ln->level[0].forward;
}
inline bool IsUnder(bool reverse, double score, const zrangespec& spec) {
return reverse ? zslValueGteMin(score, &spec) : zslValueLteMax(score, &spec);
}
double GetObjScore(const void* obj) { double GetObjScore(const void* obj) {
sds s = (sds)obj; sds s = (sds)obj;
char* ptr = s + sdslen(s) + 1; char* ptr = s + sdslen(s) + 1;

View file

@ -1,11 +1,9 @@
option(DF_ENABLE_MEMORY_TRACKING "Adds memory tracking debugging via MEMORY TRACK command" ON)
option(PRINT_STACKTRACES_ON_SIGNAL "Enables DF to print all fiber stacktraces on SIGUSR1" OFF)
add_executable(dragonfly dfly_main.cc version_monitor.cc) add_executable(dragonfly dfly_main.cc version_monitor.cc)
cxx_link(dragonfly base dragonfly_lib) cxx_link(dragonfly base dragonfly_lib)
option(DF_ENABLE_MEMORY_TRACKING "Adds memory tracking debugging via MEMORY TRACK command" ON)
if (DF_ENABLE_MEMORY_TRACKING)
target_compile_definitions(dragonfly PRIVATE DFLY_ENABLE_MEMORY_TRACKING)
endif()
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_BUILD_TYPE STREQUAL "Release")
# Add core2 only to this file, thus avoiding instructions in this object file that # Add core2 only to this file, thus avoiding instructions in this object file that
# can cause SIGILL. # can cause SIGILL.
@ -54,18 +52,16 @@ add_library(dragonfly_lib engine_shard_set.cc channel_store.cc
if (DF_ENABLE_MEMORY_TRACKING) if (DF_ENABLE_MEMORY_TRACKING)
target_compile_definitions(dragonfly_lib PRIVATE DFLY_ENABLE_MEMORY_TRACKING) target_compile_definitions(dragonfly_lib PRIVATE DFLY_ENABLE_MEMORY_TRACKING)
target_compile_definitions(dragonfly PRIVATE DFLY_ENABLE_MEMORY_TRACKING)
endif() endif()
cxx_link(dfly_transaction dfly_core strings_lib TRDP::fast_float)
option(PRINT_STACKTRACES_ON_SIGNAL "Enables DF to print all fiber stacktraces on SIGUSR1" OFF)
if (PRINT_STACKTRACES_ON_SIGNAL) if (PRINT_STACKTRACES_ON_SIGNAL)
target_compile_definitions(dragonfly_lib PRIVATE PRINT_STACKTRACES_ON_SIGNAL) target_compile_definitions(dragonfly_lib PRIVATE PRINT_STACKTRACES_ON_SIGNAL)
endif() endif()
find_library(ZSTD_LIB NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR REQUIRED) find_library(ZSTD_LIB NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR REQUIRED)
cxx_link(dfly_transaction dfly_core strings_lib TRDP::fast_float)
cxx_link(dragonfly_lib dfly_transaction dfly_facade redis_lib awsv2_lib strings_lib html_lib cxx_link(dragonfly_lib dfly_transaction dfly_facade redis_lib awsv2_lib strings_lib html_lib
http_client_lib absl::random_random TRDP::jsoncons ${ZSTD_LIB} TRDP::lz4 http_client_lib absl::random_random TRDP::jsoncons ${ZSTD_LIB} TRDP::lz4
TRDP::croncpp) TRDP::croncpp)

View file

@ -35,8 +35,10 @@ namespace dfly::acl {
} }
// GCC yields a wrong warning about uninitialized optional use // GCC yields a wrong warning about uninitialized optional use
#ifdef __GNUC__
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
[[nodiscard]] std::pair<bool, AclLog::Reason> IsUserAllowedToInvokeCommandGeneric( [[nodiscard]] std::pair<bool, AclLog::Reason> IsUserAllowedToInvokeCommandGeneric(
uint32_t acl_cat, const std::vector<uint64_t>& acl_commands, const AclKeys& keys, uint32_t acl_cat, const std::vector<uint64_t>& acl_commands, const AclKeys& keys,

View file

@ -594,8 +594,10 @@ void BitCount(CmdArgList args, ConnectionContext* cntx) {
} }
// GCC yields a wrong warning about uninitialized optional use // GCC yields a wrong warning about uninitialized optional use
#ifdef __GNUC__
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
enum class EncodingType { UINT, INT, NILL }; enum class EncodingType { UINT, INT, NILL };

View file

@ -39,7 +39,7 @@ vector<vector<unsigned>> Partition(unsigned num_flows) {
ClusterSlotMigration::ClusterSlotMigration(string host_ip, uint16_t port, Service* se, ClusterSlotMigration::ClusterSlotMigration(string host_ip, uint16_t port, Service* se,
std::vector<ClusterConfig::SlotRange> slots) std::vector<ClusterConfig::SlotRange> slots)
: ProtocolClient(move(host_ip), port), service_(*se), slots_(std::move(slots)) { : ProtocolClient(std::move(host_ip), port), service_(*se), slots_(std::move(slots)) {
} }
ClusterSlotMigration::~ClusterSlotMigration() { ClusterSlotMigration::~ClusterSlotMigration() {

View file

@ -37,7 +37,7 @@ StoredCmd::StoredCmd(const CommandId* cid, CmdArgList args, facade::ReplyMode mo
} }
StoredCmd::StoredCmd(string&& buffer, const CommandId* cid, CmdArgList args, facade::ReplyMode mode) StoredCmd::StoredCmd(string&& buffer, const CommandId* cid, CmdArgList args, facade::ReplyMode mode)
: cid_{cid}, buffer_{move(buffer)}, sizes_(args.size()), reply_mode_{mode} { : cid_{cid}, buffer_{std::move(buffer)}, sizes_(args.size()), reply_mode_{mode} {
for (unsigned i = 0; i < args.size(); i++) { for (unsigned i = 0; i < args.size(); i++) {
// Assume tightly packed list. // Assume tightly packed list.
DCHECK(i + 1 == args.size() || args[i].data() + args[i].size() == args[i + 1].data()); DCHECK(i + 1 == args.size() || args[i].data() + args[i].size() == args[i + 1].data());

View file

@ -32,8 +32,8 @@ class HestFamilyTestProtocolVersioned : public HSetFamilyTest,
protected: protected:
}; };
INSTANTIATE_TEST_CASE_P(HestFamilyTestProtocolVersioned, HestFamilyTestProtocolVersioned, INSTANTIATE_TEST_SUITE_P(HestFamilyTestProtocolVersioned, HestFamilyTestProtocolVersioned,
::testing::Values("2", "3")); ::testing::Values("2", "3"));
TEST_F(HSetFamilyTest, Basic) { TEST_F(HSetFamilyTest, Basic) {
auto resp = Run({"hset", "x", "a"}); auto resp = Run({"hset", "x", "a"});

View file

@ -332,15 +332,16 @@ void MemoryCmd::Track(CmdArgList args) {
} }
if (sub_cmd == "ADD") { if (sub_cmd == "ADD") {
auto [lower_bound, upper_bound, odds] = parser.Next<size_t, size_t, double>(); AllocationTracker::TrackingInfo tracking_info;
std::tie(tracking_info.lower_bound, tracking_info.upper_bound, tracking_info.sample_odds) =
parser.Next<size_t, size_t, double>();
if (parser.HasError()) { if (parser.HasError()) {
return cntx_->SendError(parser.Error()->MakeReply()); return cntx_->SendError(parser.Error()->MakeReply());
} }
atomic_bool error{false}; atomic_bool error{false};
shard_set->pool()->Await([&](unsigned index, auto*) { shard_set->pool()->Await([&](unsigned index, auto*) {
if (!AllocationTracker::Get().Add( if (!AllocationTracker::Get().Add(tracking_info)) {
{.lower_bound = lower_bound, .upper_bound = upper_bound, .sample_odds = odds})) {
error.store(true); error.store(true);
} }
}); });
@ -359,8 +360,8 @@ void MemoryCmd::Track(CmdArgList args) {
} }
atomic_bool error{false}; atomic_bool error{false};
shard_set->pool()->Await([&](unsigned index, auto*) { shard_set->pool()->Await([&, lo = lower_bound, hi = upper_bound](unsigned index, auto*) {
if (!AllocationTracker::Get().Remove(lower_bound, upper_bound)) { if (!AllocationTracker::Get().Remove(lo, hi)) {
error.store(true); error.store(true);
} }
}); });

View file

@ -638,7 +638,7 @@ TEST_F(MultiTest, MultiCauseUnblocking) {
const int kRounds = 10; const int kRounds = 10;
vector<string> keys = {kKeySid0, kKeySid1, kKeySid2}; vector<string> keys = {kKeySid0, kKeySid1, kKeySid2};
auto push = [this, keys, kRounds]() mutable { auto push = [this, keys]() mutable {
int i = 0; int i = 0;
do { do {
Run({"multi"}); Run({"multi"});
@ -648,7 +648,7 @@ TEST_F(MultiTest, MultiCauseUnblocking) {
} while (next_permutation(keys.begin(), keys.end()) || i++ < kRounds); } while (next_permutation(keys.begin(), keys.end()) || i++ < kRounds);
}; };
auto pop = [this, keys, kRounds]() mutable { auto pop = [this, keys]() mutable {
int i = 0; int i = 0;
do { do {
for (int j = keys.size() - 1; j >= 0; j--) for (int j = keys.size() - 1; j >= 0; j--)

View file

@ -2276,7 +2276,7 @@ error_code RdbLoader::HandleAux() {
} else if (auxkey == "repl-offset") { } else if (auxkey == "repl-offset") {
// TODO // TODO
} else if (auxkey == "lua") { } else if (auxkey == "lua") {
LoadScriptFromAux(move(auxval)); LoadScriptFromAux(std::move(auxval));
} else if (auxkey == "redis-ver") { } else if (auxkey == "redis-ver") {
VLOG(1) << "Loading RDB produced by version " << auxval; VLOG(1) << "Loading RDB produced by version " << auxval;
} else if (auxkey == "ctime") { } else if (auxkey == "ctime") {

View file

@ -1286,7 +1286,7 @@ RdbSaver::GlobalData RdbSaver::GetGlobalData(const Service* service) {
auto scripts = service->script_mgr()->GetAll(); auto scripts = service->script_mgr()->GetAll();
script_bodies.reserve(scripts.size()); script_bodies.reserve(scripts.size());
for (auto& [sha, data] : scripts) for (auto& [sha, data] : scripts)
script_bodies.push_back(move(data.body)); script_bodies.push_back(std::move(data.body));
} }
#ifndef __APPLE__ #ifndef __APPLE__

View file

@ -179,11 +179,11 @@ JsonAccessor::JsonPathContainer* JsonAccessor::GetPath(std::string_view field) c
return nullptr; return nullptr;
} }
JsonPathContainer path_container{move(path_expr)}; JsonPathContainer path_container{std::move(path_expr)};
auto ptr = make_unique<JsonPathContainer>(move(path_container)); auto ptr = make_unique<JsonPathContainer>(std::move(path_container));
JsonPathContainer* path = ptr.get(); JsonPathContainer* path = ptr.get();
path_cache_[field] = move(ptr); path_cache_[field] = std::move(ptr);
return path; return path;
} }

View file

@ -248,7 +248,7 @@ ShardDocIndex* ShardDocIndices::GetIndex(string_view name) {
void ShardDocIndices::InitIndex(const OpArgs& op_args, std::string_view name, void ShardDocIndices::InitIndex(const OpArgs& op_args, std::string_view name,
shared_ptr<DocIndex> index_ptr) { shared_ptr<DocIndex> index_ptr) {
auto shard_index = make_unique<ShardDocIndex>(index_ptr); auto shard_index = make_unique<ShardDocIndex>(index_ptr);
auto [it, _] = indices_.emplace(name, move(shard_index)); auto [it, _] = indices_.emplace(name, std::move(shard_index));
// Don't build while loading, shutting down, etc. // Don't build while loading, shutting down, etc.
// After loading, indices are rebuilt separately // After loading, indices are rebuilt separately

View file

@ -175,7 +175,11 @@ class ShardDocIndices {
absl::flat_hash_map<std::string, std::unique_ptr<ShardDocIndex>> indices_; absl::flat_hash_map<std::string, std::unique_ptr<ShardDocIndex>> indices_;
}; };
#ifdef __APPLE__ #if defined(__APPLE__)
inline ShardDocIndices::ShardDocIndices() : local_mr_{nullptr} {
}
inline ShardDocIndex* ShardDocIndices::GetIndex(std::string_view name) { inline ShardDocIndex* ShardDocIndices::GetIndex(std::string_view name) {
return nullptr; return nullptr;
} }
@ -211,5 +215,13 @@ inline SearchStats ShardDocIndices::GetStats() const {
return {}; return {};
} }
inline DocIndexInfo ShardDocIndex::GetInfo() const {
return {};
}
inline std::string DocIndexInfo::BuildRestoreCommand() const {
return {};
}
#endif // __APPLE__ #endif // __APPLE__
} // namespace dfly } // namespace dfly

View file

@ -169,7 +169,7 @@ const uint32_t STREAM_LISTPACK_MAX_PRE_ALLOCATE = 4096;
/* Every stream item inside the listpack, has a flags field that is used to /* Every stream item inside the listpack, has a flags field that is used to
* mark the entry as deleted, or having the same field as the "master" * mark the entry as deleted, or having the same field as the "master"
* entry at the start of the listpack. */ * entry at the start of the listpack. */
const uint32_t STREAM_ITEM_FLAG_DELETED = (1 << 0); /* Entry is deleted. Skip it. */ // const uint32_t STREAM_ITEM_FLAG_DELETED = (1 << 0); /* Entry is deleted. Skip it. */
const uint32_t STREAM_ITEM_FLAG_SAMEFIELDS = (1 << 1); /* Same fields as master entry. */ const uint32_t STREAM_ITEM_FLAG_SAMEFIELDS = (1 << 1); /* Same fields as master entry. */
string StreamIdRepr(const streamID& id) { string StreamIdRepr(const streamID& id) {

View file

@ -41,7 +41,7 @@ using namespace facade;
using CI = CommandId; using CI = CommandId;
constexpr uint32_t kMaxStrLen = 1 << 28; constexpr uint32_t kMaxStrLen = 1 << 28;
constexpr size_t kMinTieredLen = TieredStorage::kMinBlobLen; [[maybe_unused]] constexpr size_t kMinTieredLen = TieredStorage::kMinBlobLen;
size_t CopyValueToBuffer(const PrimeValue& pv, char* dest) { size_t CopyValueToBuffer(const PrimeValue& pv, char* dest) {
DCHECK_EQ(pv.ObjType(), OBJ_STRING); DCHECK_EQ(pv.ObjType(), OBJ_STRING);

View file

@ -74,7 +74,7 @@ void TestConnection::SendPubMessageAsync(PubMessage pmsg) {
} }
void TestConnection::SendInvalidationMessageAsync(InvalidationMessage msg) { void TestConnection::SendInvalidationMessageAsync(InvalidationMessage msg) {
invalidate_messages.push_back(move(msg)); invalidate_messages.push_back(std::move(msg));
} }
std::string TestConnection::RemoteEndpointStr() const { std::string TestConnection::RemoteEndpointStr() const {
@ -228,7 +228,7 @@ void BaseFamilyTest::ResetService() {
watchdog_fiber_ = pp_->GetNextProactor()->LaunchFiber([this] { watchdog_fiber_ = pp_->GetNextProactor()->LaunchFiber([this] {
ThisFiber::SetName("Watchdog"); ThisFiber::SetName("Watchdog");
if (!watchdog_done_.WaitFor(60s)) { if (!watchdog_done_.WaitFor(20s)) {
LOG(ERROR) << "Deadlock detected!!!!"; LOG(ERROR) << "Deadlock detected!!!!";
absl::SetFlag(&FLAGS_alsologtostderr, true); absl::SetFlag(&FLAGS_alsologtostderr, true);
fb2::Mutex m; fb2::Mutex m;

View file

@ -3249,7 +3249,7 @@ void ZSetFamily::Register(CommandRegistry* registry) {
*registry *registry
<< CI{"ZADD", CO::FAST | CO::WRITE | CO::DENYOOM, -4, 1, 1, acl::kZAdd}.HFUNC(ZAdd) << CI{"ZADD", CO::FAST | CO::WRITE | CO::DENYOOM, -4, 1, 1, acl::kZAdd}.HFUNC(ZAdd)
<< CI{"BZPOPMIN", CO::WRITE | CO::NOSCRIPT | CO::BLOCKING | CO::NO_AUTOJOURNAL, -3, 1, -2, << CI{"BZPOPMIN", CO::WRITE | CO::NOSCRIPT | CO::BLOCKING | CO::NO_AUTOJOURNAL, -3, 1, -2,
acl::kBZPopMax} acl::kBZPopMin}
.HFUNC(BZPopMin) .HFUNC(BZPopMin)
<< CI{"BZPOPMAX", CO::WRITE | CO::NOSCRIPT | CO::BLOCKING | CO::NO_AUTOJOURNAL, -3, 1, -2, << CI{"BZPOPMAX", CO::WRITE | CO::NOSCRIPT | CO::BLOCKING | CO::NO_AUTOJOURNAL, -3, 1, -2,
acl::kBZPopMax} acl::kBZPopMax}
@ -3268,7 +3268,7 @@ void ZSetFamily::Register(CommandRegistry* registry) {
<< CI{"ZREM", CO::FAST | CO::WRITE, -3, 1, 1, acl::kZRem}.HFUNC(ZRem) << CI{"ZREM", CO::FAST | CO::WRITE, -3, 1, 1, acl::kZRem}.HFUNC(ZRem)
<< CI{"ZRANGE", CO::READONLY, -4, 1, 1, acl::kZRange}.HFUNC(ZRange) << CI{"ZRANGE", CO::READONLY, -4, 1, 1, acl::kZRange}.HFUNC(ZRange)
<< CI{"ZRANDMEMBER", CO::READONLY, -2, 1, 1, acl::kZRandMember}.HFUNC(ZRandMember) << CI{"ZRANDMEMBER", CO::READONLY, -2, 1, 1, acl::kZRandMember}.HFUNC(ZRandMember)
<< CI{"ZRANK", CO::READONLY | CO::FAST, 3, 1, 1, acl::kZRange}.HFUNC(ZRank) << CI{"ZRANK", CO::READONLY | CO::FAST, 3, 1, 1, acl::kZRank}.HFUNC(ZRank)
<< CI{"ZRANGEBYLEX", CO::READONLY, -4, 1, 1, acl::kZRangeByLex}.HFUNC(ZRangeByLex) << CI{"ZRANGEBYLEX", CO::READONLY, -4, 1, 1, acl::kZRangeByLex}.HFUNC(ZRangeByLex)
<< CI{"ZRANGEBYSCORE", CO::READONLY, -4, 1, 1, acl::kZRangeByScore}.HFUNC(ZRangeByScore) << CI{"ZRANGEBYSCORE", CO::READONLY, -4, 1, 1, acl::kZRangeByScore}.HFUNC(ZRangeByScore)
<< CI{"ZSCORE", CO::READONLY | CO::FAST, 3, 1, 1, acl::kZScore}.HFUNC(ZScore) << CI{"ZSCORE", CO::READONLY | CO::FAST, 3, 1, 1, acl::kZScore}.HFUNC(ZScore)