-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt device type #167
Adopt device type #167
Changes from 7 commits
6e6fa72
fc8e161
c68746d
f7c8620
251ae9e
476fa06
00ab48e
ff62e8f
8436d39
aa43265
be41347
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,13 @@ class HSReplApplication : public homestore::ReplApplication { | |
// | ||
// This should assert if we can not initialize HomeStore. | ||
// | ||
DevType HSHomeObject::get_device_type(string const& devname) { | ||
const iomgr::drive_type dtype = iomgr::DriveInterface::get_drive_type(devname); | ||
if (dtype == iomgr::drive_type::block_hdd || dtype == iomgr::drive_type::file_on_hdd) { return DevType::HDD; } | ||
if (dtype == iomgr::drive_type::file_on_nvme || dtype == iomgr::drive_type::block_nvme) { return DevType::NVME; } | ||
return DevType::UNSUPPORTED; | ||
} | ||
|
||
void HSHomeObject::init_homestore() { | ||
auto app = _application.lock(); | ||
RELEASE_ASSERT(app, "HomeObjectApplication lifetime unexpected!"); | ||
|
@@ -115,9 +122,27 @@ void HSHomeObject::init_homestore() { | |
LOGI("Initialize and start HomeStore with app_mem_size = {}", homestore::in_bytes(app_mem_size)); | ||
|
||
std::vector< homestore::dev_info > device_info; | ||
for (auto const& path : app->devices()) { | ||
device_info.emplace_back(std::filesystem::canonical(path).string(), homestore::HSDevType::Data); | ||
bool has_data_dev = false; | ||
bool has_fast_dev = false; | ||
for (auto const& dev : app->devices()) { | ||
auto input_dev_type = dev.type; | ||
yamingk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
auto detected_type = get_device_type(dev.path.string()); | ||
LOGD("Device {} detected as {}", dev.path.string(), detected_type); | ||
auto final_type = (dev.type == DevType::AUTO_DETECT) ? detected_type : input_dev_type; | ||
if (final_type == DevType::UNSUPPORTED) { | ||
LOGW("Device {} is not supported, skipping", dev.path.string()); | ||
continue; | ||
} | ||
if (input_dev_type != DevType::AUTO_DETECT && detected_type != final_type) { | ||
LOGW("Device {} detected as {}, but input type is {}, using input type", dev.path.string(), detected_type, | ||
input_dev_type); | ||
} | ||
auto hs_type = (final_type == DevType::HDD) ? homestore::HSDevType::Data : homestore::HSDevType::Fast; | ||
if (hs_type == homestore::HSDevType::Data) { has_data_dev = true; } | ||
if (hs_type == homestore::HSDevType::Fast) { has_fast_dev = true; } | ||
device_info.emplace_back(std::filesystem::canonical(dev.path).string(), hs_type); | ||
} | ||
RELEASE_ASSERT(device_info.size() != 0, "No supported devices found!"); | ||
|
||
xiaoxichen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
chunk_selector_ = std::make_shared< HeapChunkSelector >(); | ||
using namespace homestore; | ||
|
@@ -134,17 +159,39 @@ void HSHomeObject::init_homestore() { | |
RELEASE_ASSERT(!_our_id.is_nil(), "Received no SvcId and need FORMAT!"); | ||
LOGW("We are starting for the first time on [{}], Formatting!!", to_string(_our_id)); | ||
|
||
HomeStore::instance()->format_and_start({ | ||
{HS_SERVICE::META, hs_format_params{.size_pct = 5.0}}, | ||
{HS_SERVICE::LOG, hs_format_params{.size_pct = 10.0, .chunk_size = 32 * Mi}}, | ||
{HS_SERVICE::REPLICATION, | ||
hs_format_params{.size_pct = 79.0, | ||
.num_chunks = 65000, | ||
.block_size = _data_block_size, | ||
.alloc_type = blk_allocator_type_t::append, | ||
.chunk_sel_type = chunk_selector_type_t::CUSTOM}}, | ||
{HS_SERVICE::INDEX, hs_format_params{.size_pct = 5.0}}, | ||
}); | ||
if (has_data_dev && has_fast_dev) { | ||
// Hybrid mode | ||
LOGD("Has both Data and Fast, running with Hybrid mode"); | ||
HomeStore::instance()->format_and_start({ | ||
{HS_SERVICE::META, hs_format_params{.dev_type = HSDevType::Fast, .size_pct = 9.0, .num_chunks = 64}}, | ||
{HS_SERVICE::LOG, | ||
hs_format_params{.dev_type = HSDevType::Fast, .size_pct = 45.0, .chunk_size = 32 * Mi}}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand if chunk_size is specified, HS starts from 0 num_chunks, but how does it know how many chunks has been created in total, and what is the available number chunks this LOG service can use, is there a place we assert that the total number chunks created is less than 64K (this is that FIXME you've put in creaet_vdev, right?). I did some calculation, say one NVME drive is 500GB, 45% is around 200GB and it will require 6400 number of chunks with 32MB chunk size. 6400 + 64 + 128 + 65000 will exceed 64K, right? Please correct me if I missed something here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes this is very tricky part. The log device go with chunk_size and it creates chunk dynamically, so worth case it could create For the configuration now I tend to believe the behavior will be only 344 chunks is availalbe for log, bounding max logstore size to 344*32MB = 11G. I will reduce the 65000 to 60000 for now. Other enhancement can be taken care later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the ideal solution (with your change, in homestore) seems to be, log device should use that chunk_size, and num_chunks should not exceeding the total 64K, regardless of the pct set for this log service. This will result in losing some space not being used, better than creating chunk numbers that will overflow the chunk number and cause correctness issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes I think we need to change the log vdev , when creating a There will not be correctness issue as in pdev::create_chunk , it will throw |
||
{HS_SERVICE::INDEX, hs_format_params{.dev_type = HSDevType::Fast, .size_pct = 45.0, .num_chunks = 128}}, | ||
{HS_SERVICE::REPLICATION, | ||
hs_format_params{.dev_type = HSDevType::Data, | ||
.size_pct = 99.0, | ||
.num_chunks = 65000, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't num_chunks from NVME drives + num_chunks from HDD equal to 65000? Is it because maximum is 64K which is 65536, and we leave the 536 for NVME chunks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes that is the idea, as said, lower it to 60000 to give more chunks to nvme |
||
.block_size = _data_block_size, | ||
.alloc_type = blk_allocator_type_t::append, | ||
.chunk_sel_type = chunk_selector_type_t::CUSTOM}}, | ||
}); | ||
} else { | ||
auto run_on_type = has_fast_dev ? homestore::HSDevType::Fast : homestore::HSDevType::Data; | ||
LOGD("Running with Single mode, all service on {}", run_on_type); | ||
HomeStore::instance()->format_and_start({ | ||
// FIXME: this is to work around the issue in HS that varsize allocator doesnt work with small chunk size. | ||
{HS_SERVICE::META, hs_format_params{.dev_type = run_on_type, .size_pct = 5.0, .num_chunks = 1}}, | ||
{HS_SERVICE::LOG, hs_format_params{.dev_type = run_on_type, .size_pct = 10.0, .chunk_size = 32 * Mi}}, | ||
{HS_SERVICE::INDEX, hs_format_params{.dev_type = run_on_type, .size_pct = 5.0, .num_chunks = 1}}, | ||
{HS_SERVICE::REPLICATION, | ||
hs_format_params{.dev_type = run_on_type, | ||
.size_pct = 79.0, | ||
.num_chunks = 65000, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should also be adjusted, right? 10 pct of total device would be still very large and exceed 64K in total? Also can we be more conservative say setting this to 40000, before the fixme part is done? I am not sure what will be the total disk size in production, we probably need some careful calculation. For mixed mode, I remember hearing something from John D saying we would have around 900GB of nvme per SM, and it would result in around 12800 num_chunks for logstore with 32MB chunk_size. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, lets postpone this calculation and will get it from testing on real environment. |
||
.block_size = _data_block_size, | ||
.alloc_type = blk_allocator_type_t::append, | ||
.chunk_sel_type = chunk_selector_type_t::CUSTOM}}, | ||
}); | ||
} | ||
|
||
// Create a superblock that contains our SvcId | ||
auto svc_sb = homestore::superblk< svc_info_superblk_t >(_svc_meta_name); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: if HS made some api change that will break HO build, previously we only bump minor version, this stays true still, right? e.g. we don't need to bump major, just bump minor for HS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure...previously we bumped the major version. We discussed in HS meeting but I am not sure a decision has been made.
If that is the case, we need to pin to [^6.2.0]