Skip to content

Commit

Permalink
feat all: drop phdr-cache experiment, enable it by default
Browse files Browse the repository at this point in the history
  • Loading branch information
itrofimow committed Nov 16, 2023
1 parent 00d16a4 commit 88b942c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
2 changes: 0 additions & 2 deletions core/include/userver/utils/impl/userver_experiments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ class UserverExperimentsScope final {
// TODO move to userver/mongo once the issues with linker are resolved.
extern UserverExperiment kRedisClusterAutoTopologyExperiment;

extern UserverExperiment kPhdrCacheExperiment;

} // namespace utils::impl

USERVER_NAMESPACE_END
6 changes: 3 additions & 3 deletions core/src/engine/task/exception_hacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,20 @@ std::atomic<PhdrCacheStorage*> phdr_cache_ptr{nullptr};
class PhdrCache final {
public:
void Initialize() {
if (!utils::impl::kPhdrCacheExperiment.IsEnabled()) {
if (phdr_cache_ptr.load() != nullptr) {
return;
}
LOG_INFO() << "Initializing phdr cache";

cache_.clear();
GetOriginalDlIteratePhdr()(
[](dl_phdr_info* info, size_t /* size */, void* data) {
reinterpret_cast<PhdrCacheStorage*>(data)->push_back(*info);
return 0;
},
&cache_);

[[maybe_unused]] const auto* old_cache = phdr_cache_ptr.exchange(&cache_);
UASSERT(!old_cache);
phdr_cache_ptr.exchange(&cache_);

LOG_INFO() << "Initialized phdr cache for " << cache_.size() << " objects";
}
Expand Down
2 changes: 0 additions & 2 deletions core/src/utils/impl/userver_experiments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ void UserverExperimentsScope::EnableOnly(
UserverExperiment kRedisClusterAutoTopologyExperiment{
"redis-cluster-autotopology"};

UserverExperiment kPhdrCacheExperiment{"phdr-cache"};

} // namespace utils::impl

USERVER_NAMESPACE_END
9 changes: 1 addition & 8 deletions core/testing/src/utest/gtest_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ void SetLogLevel(logging::Level log_level) {
logging::SetDefaultLoggerLevel(log_level);
}

void InitPhdrCache() {
static USERVER_NAMESPACE::utils::impl::UserverExperimentsScope
phdr_cache_scope{};
phdr_cache_scope.Set(USERVER_NAMESPACE::utils::impl::kPhdrCacheExperiment,
true);

USERVER_NAMESPACE::engine::impl::InitPhdrCache();
}
void InitPhdrCache() { USERVER_NAMESPACE::engine::impl::InitPhdrCache(); }

void TeardownPhdrCache() {
USERVER_NAMESPACE::engine::impl::TeardownPhdrCacheAndEnableDynamicLoading();
Expand Down

0 comments on commit 88b942c

Please sign in to comment.