Skip to content

Commit 70c9af6

Browse files
committed
Fix device list for test_raft_repl_dev.
Previous code will add `ndevices` simulated drive into device list which make each replica go with one real drive and ndevices simulated drive. Those simulated drives are identified as FAST, meta/log were on them. Due to the very limited size of simulated drive, we can hit size limit in long running test. Fixing by honor input from hs_repl_test_common. After this fix, if only one drive passed in for a replica of test_raft_repl_dev, that drive will be used as FAST. All services will be started on that real drive. Signed-off-by: Xiaoxi Chen <xiaoxchen@ebay.com>
1 parent 1a0cef8 commit 70c9af6

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class HomestoreConan(ConanFile):
77
name = "homestore"
8-
version = "6.4.24"
8+
version = "6.4.25"
99
homepage = "https://github.com/eBay/Homestore"
1010
description = "HomeStore Storage Engine"
1111
topics = ("ebay", "nublox")

src/tests/test_common/homestore_test_common.hpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,8 @@ class HSTestHelper {
181181
do_start_homestore(false /* fake_restart */, init_device);
182182
}
183183

184-
185184
virtual void restart_homestore(uint32_t shutdown_delay_sec = 5) {
186185
do_start_homestore(true /* fake_restart*/, false /* init_device */, shutdown_delay_sec);
187-
188186
}
189187

190188
virtual void shutdown_homestore(bool cleanup = true) {
@@ -346,6 +344,14 @@ class HSTestHelper {
346344
// Fake restart, device list is unchanged.
347345
shutdown_homestore(false);
348346
std::this_thread::sleep_for(std::chrono::seconds{shutdown_delay_sec});
347+
} else if (!m_token.devs_.empty()) {
348+
// For those UTs already process device list, like test_raft_repl_dev.
349+
LOGINFO("Using passed in dev_list: {}",
350+
std::accumulate(m_token.devs_.begin(), m_token.devs_.end(), std::string(""),
351+
[](const std::string& s, const homestore::dev_info& dinfo) {
352+
return s.empty() ? dinfo.dev_name : s + "," + dinfo.dev_name;
353+
}));
354+
349355
} else if (SISL_OPTIONS.count("device_list")) {
350356
// User has provided explicit device list, use that and initialize them
351357
auto const devs = SISL_OPTIONS["device_list"].as< std::vector< std::string > >();
@@ -427,6 +433,9 @@ class HSTestHelper {
427433
set_min_chunk_size(m_token.svc_params_[HS_SERVICE::LOG].min_chunk_size);
428434
}
429435

436+
// in UT we assume first drive is FAST, rest are DATA.
437+
bool has_data_drive = m_token.devs_.size() > 1;
438+
430439
if (need_format) {
431440
auto svc_params = m_token.svc_params_;
432441
hsi->format_and_start(
@@ -446,7 +455,8 @@ class HSTestHelper {
446455
: chunk_selector_type_t::ROUND_ROBIN}},
447456
{HS_SERVICE::INDEX, {.size_pct = svc_params[HS_SERVICE::INDEX].size_pct}},
448457
{HS_SERVICE::REPLICATION,
449-
{.size_pct = svc_params[HS_SERVICE::REPLICATION].size_pct,
458+
{.dev_type = has_data_drive ? homestore::HSDevType::Data : homestore::HSDevType::Fast,
459+
.size_pct = svc_params[HS_SERVICE::REPLICATION].size_pct,
450460
.alloc_type = svc_params[HS_SERVICE::REPLICATION].blkalloc_type,
451461
.chunk_sel_type = svc_params[HS_SERVICE::REPLICATION].custom_chunk_selector
452462
? chunk_selector_type_t::CUSTOM

src/tests/test_common/hs_repl_test_common.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ class HSReplTestHelper : public HSTestHelper {
168168
}
169169
}
170170
for (auto const& dev : rdev_list[replica_num_]) {
171-
dev_list_.emplace_back(dev, homestore::HSDevType::Data);
171+
dev_list_.emplace_back(dev,
172+
dev_list_.empty() ? homestore::HSDevType::Fast : homestore::HSDevType::Data);
172173
}
173174
}
174175

0 commit comments

Comments
 (0)