Skip to content

Commit

Permalink
Adjust num chunks requested in device manager. (#197)
Browse files Browse the repository at this point in the history
Fix timer related asan issue.
Disable index btree remove api's as its conflict with cp flush.
  • Loading branch information
sanebay authored Oct 5, 2023
1 parent 0a878d4 commit 119e67e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 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 = "4.5.1"
version = "4.5.2"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
7 changes: 4 additions & 3 deletions src/lib/checkpoint/cp_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ void CPManager::create_first_cp() {
}

void CPManager::shutdown() {
LOGINFO("Stopping cp timer");
iomanager.cancel_timer(m_cp_timer_hdl, true);
m_cp_timer_hdl = iomgr::null_timer_handle;

auto cp = get_cur_cp();
delete (cp);
rcu_xchg_pointer(&m_cur_cp, nullptr);
Expand All @@ -79,9 +83,6 @@ void CPManager::shutdown() {
m_wd_cp->stop();
m_wd_cp.reset();
}

iomanager.cancel_timer(m_cp_timer_hdl, true);
m_cp_timer_hdl = iomgr::null_timer_handle;
}

void CPManager::register_consumer(cp_consumer_t consumer_id, std::unique_ptr< CPCallbacks > callbacks) {
Expand Down
13 changes: 13 additions & 0 deletions src/lib/device/device_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,19 @@ shared< VirtualDev > DeviceManager::create_vdev(vdev_parameters&& vparam) {
LOGINFO("{} Virtual device is attempted to be created with size={}, it needs to be rounded to new_size={}",
vparam.vdev_name, in_bytes(input_vdev_size), in_bytes(vparam.vdev_size));
}

// Adjust the maximum number chunks requested.
uint32_t max_num_chunks = 0;
for (const auto& d : m_dev_infos) {
max_num_chunks += hs_super_blk::max_chunks_in_pdev(d);
}
auto input_num_chunks = vparam.num_chunks;
vparam.num_chunks = std::min(vparam.num_chunks, max_num_chunks);
if (input_num_chunks != vparam.num_chunks) {
LOGINFO("{} Virtual device is attempted to be created with num_chunks={}, it needs to be adjust to "
"new_num_chunks={}",
vparam.vdev_name, in_bytes(input_num_chunks), in_bytes(vparam.num_chunks));
}
uint32_t chunk_size = vparam.vdev_size / vparam.num_chunks;

LOGINFO(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/device/physical_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ void PhysicalDev::free_chunk_info(chunk_info* cinfo) {
}

ChunkInterval PhysicalDev::find_next_chunk_area(uint64_t size) const {
auto ins_ival = ChunkInterval::right_open(data_start_offset(), size);
auto ins_ival = ChunkInterval::right_open(data_start_offset(), data_start_offset() + size);
for (auto& exist_ival : m_chunk_data_area) {
if (ins_ival.upper() <= exist_ival.lower()) { break; }
ins_ival = ChunkInterval::right_open(exist_ival.upper(), exist_ival.upper() + size);
Expand Down
5 changes: 3 additions & 2 deletions src/lib/logstore/log_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ void LogDev::stop() {
m_block_flush_q_cv.wait(lk, [&] { return m_stopped; });
}

// cancel the timer
iomanager.cancel_timer(m_flush_timer_hdl, true);

m_log_records = nullptr;
m_logdev_meta.reset();
m_log_idx.store(0);
Expand All @@ -137,8 +140,6 @@ void LogDev::stop() {
}

THIS_LOGDEV_LOG(INFO, "LogDev stopped successfully");
// cancel the timer
iomanager.cancel_timer(m_flush_timer_hdl, true);
m_hs.reset();
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_device_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ TEST_F(DeviceMgrTest, StripedVDevCreation) {
avail_size += pdev->data_size();
}

uint32_t size_pct = 4;
uint32_t size_pct = 2;
uint64_t remain_size = avail_size;

LOGINFO("Step 1: Creating {} vdevs with combined size as {}", in_bytes(avail_size));
Expand Down
2 changes: 2 additions & 0 deletions src/tests/test_index_btree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ TYPED_TEST(BtreeTest, RandomInsert) {
this->get_all_validate();
}

#if 0
TYPED_TEST(BtreeTest, SequentialRemove) {
LOGINFO("SequentialRemove test start");
// Forward sequential insert
Expand Down Expand Up @@ -466,6 +467,7 @@ TYPED_TEST(BtreeTest, RandomRemove) {
}
this->get_all_validate();
}
#endif

TYPED_TEST(BtreeTest, RangeUpdate) {
LOGINFO("RangeUpdate test start");
Expand Down

0 comments on commit 119e67e

Please sign in to comment.