Skip to content

Commit

Permalink
Disable resource mgr truncation timer in logstore and logdev tests. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sanebay authored Apr 25, 2024
1 parent 7eafcf2 commit cbe45ef
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.3.3"
version = "6.3.4"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
6 changes: 5 additions & 1 deletion src/lib/common/resource_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void ResourceMgr::start(uint64_t total_cap) {

void ResourceMgr::stop() {
LOGINFO("Cancel resource manager timer.");
iomanager.cancel_timer(m_res_audit_timer_hdl);
if (m_res_audit_timer_hdl != iomgr::null_timer_handle) { iomanager.cancel_timer(m_res_audit_timer_hdl); }
m_res_audit_timer_hdl = iomgr::null_timer_handle;
}

Expand Down Expand Up @@ -66,6 +66,10 @@ void ResourceMgr::trigger_truncate() {
void ResourceMgr::start_timer() {
auto const res_mgr_timer_ms = HS_DYNAMIC_CONFIG(resource_limits.resource_audit_timer_ms);
LOGINFO("resource audit timer is set to {} usec", res_mgr_timer_ms);
if (res_mgr_timer_ms == 0) {
LOGINFO("resource audit timer is set to 0, so not starting timer");
return;
}

m_res_audit_timer_hdl = iomanager.schedule_global_timer(
res_mgr_timer_ms * 1000 * 1000, true /* recurring */, nullptr /* cookie */, iomgr::reactor_regex::all_worker,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/common/resource_mgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class ResourceMgr {
exceed_limit_cb_t m_journal_vdev_exceed_cb;
RsrcMgrMetrics m_metrics;

iomgr::timer_handle_t m_res_audit_timer_hdl;
iomgr::timer_handle_t m_res_audit_timer_hdl{iomgr::null_timer_handle};
};

extern ResourceMgr& resource_mgr();
Expand Down
9 changes: 5 additions & 4 deletions src/lib/logstore/log_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,12 @@ bool LogDev::run_under_flush_lock(const flush_blocked_callback& cb) {

void LogDev::unlock_flush(bool do_flush) {
std::vector< flush_blocked_callback >* flush_q{nullptr};

if (m_block_flush_q != nullptr) {
{
std::unique_lock lk{m_block_flush_q_mutex};
flush_q = m_block_flush_q;
m_block_flush_q = nullptr;
if (m_block_flush_q != nullptr) {
flush_q = m_block_flush_q;
m_block_flush_q = nullptr;
}
}

if (flush_q) {
Expand Down
21 changes: 7 additions & 14 deletions src/tests/test_log_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,13 @@ class LogDevTest : public ::testing::Test {
void start_homestore(bool restart = false, hs_before_services_starting_cb_t starting_cb = nullptr) {
auto const ndevices = SISL_OPTIONS["num_devs"].as< uint32_t >();
auto const dev_size = SISL_OPTIONS["dev_size_mb"].as< uint64_t >() * 1024 * 1024;
if (starting_cb == nullptr) {
starting_cb = [this]() {
HS_SETTINGS_FACTORY().modifiable_settings([](auto& s) {
// Disable flush timer in UT.
s.logstore.flush_timer_frequency_us = 0;
});
HS_SETTINGS_FACTORY().save();
};
}
HS_SETTINGS_FACTORY().modifiable_settings([](auto& s) {
// Disable flush timer in UT.
s.logstore.flush_timer_frequency_us = 0;
s.resource_limits.resource_audit_timer_ms = 0;
});
HS_SETTINGS_FACTORY().save();

test_common::HSTestHelper::start_homestore("test_log_dev",
{
{HS_SERVICE::META, {.size_pct = 15.0}},
Expand Down Expand Up @@ -284,11 +282,6 @@ TEST_F(LogDevTest, Rollback) {
auto restart = [&]() {
std::promise< bool > p;
auto starting_cb = [&]() {
HS_SETTINGS_FACTORY().modifiable_settings([](auto& s) {
// Disable flush timer in UT.
s.logstore.flush_timer_frequency_us = 0;
});
HS_SETTINGS_FACTORY().save();
logstore_service().open_logdev(logdev_id);
logstore_service().open_log_store(logdev_id, store_id, false /* append_mode */).thenValue([&](auto store) {
log_store = store;
Expand Down
3 changes: 2 additions & 1 deletion src/tests/test_log_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,9 @@ class SampleDB {
{HS_SERVICE::LOG, {.size_pct = 84.0, .chunk_size = 8 * 1024 * 1024, .min_chunk_size = 8 * 1024 * 1024}}},
[this, restart, n_log_stores]() {
HS_SETTINGS_FACTORY().modifiable_settings([](auto& s) {
// Disable flush timer in UT.
// Disable flush and resource mgr timer in UT.
s.logstore.flush_timer_frequency_us = 0;
s.resource_limits.resource_audit_timer_ms = 0;
});
HS_SETTINGS_FACTORY().save();

Expand Down

0 comments on commit cbe45ef

Please sign in to comment.