Skip to content

Commit

Permalink
Issue: 498 meta service long run fix (eBay#523)
Browse files Browse the repository at this point in the history
* Issue: 498 meta service long run fix

* move debug assert to rel
  • Loading branch information
yamingk authored Aug 27, 2024
1 parent 7ab82d2 commit 5b26248
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/lib/device/chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class Chunk {
uint32_t m_vdev_ordinal{0};
shared< BlkAllocator > m_blk_allocator;

public:
static constexpr auto MAX_CHUNK_SIZE = std::numeric_limits< uint32_t >::max();

public:
friend class DeviceManager;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/device/device_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ shared< VirtualDev > DeviceManager::create_vdev(vdev_parameters&& vparam) {
if (vparam.num_chunks != 0) {
auto input_num_chunks = vparam.num_chunks;
// max chunk size is 4GB (uint32_max), capping it by tune up num_chunks
uint32_t min_num_chunks = (vparam.vdev_size - 1) / std::numeric_limits< uint32_t >::max() + 1;
uint32_t min_num_chunks = (vparam.vdev_size - 1) / Chunk::MAX_CHUNK_SIZE + 1;
vparam.num_chunks = std::max(vparam.num_chunks, min_num_chunks);
vparam.num_chunks = std::min(vparam.num_chunks, max_num_chunks);

Expand Down
3 changes: 2 additions & 1 deletion src/lib/device/virtual_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ BlkAllocStatus VirtualDev::commit_blk(BlkId const& blkid) {
HS_LOG(DEBUG, device, "commit_blk: bid {}", blkid.to_string());
auto const recovering = homestore::hs()->is_initializing();
if (!recovering) {
HS_DBG_ASSERT(is_blk_alloced(blkid), "commiting blkid {} is not allocated in non-recovery mode",
// in non-recovery mode, if a blk is committed without allocating, it will cause data corruption
HS_REL_ASSERT(is_blk_alloced(blkid), "commiting blkid {} is not allocated in non-recovery mode",
blkid.to_string());
} else {
chunk->blk_allocator_mutable()->reserve_on_cache(blkid);
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_scripts/log_meta_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def meta_nightly(options, addln_opts):
subprocess.check_call(options.dirpath + "test_meta_blk_mgr " + cmd_opts + addln_opts, stderr=subprocess.STDOUT,
shell=True)

cmd_opts = "--min_write_size=10485760 --max_write_size=104857600 --bitmap=1"
cmd_opts = "--min_write_size=10485760 --max_write_size=80857600 --bitmap=1"
subprocess.check_call(options.dirpath + "test_meta_blk_mgr " + cmd_opts + addln_opts, stderr=subprocess.STDOUT,
shell=True)

Expand Down

0 comments on commit 5b26248

Please sign in to comment.