diff --git a/src/lib/logstore/log_stream.cpp b/src/lib/logstore/log_stream.cpp index 105a7714e..931e03eef 100644 --- a/src/lib/logstore/log_stream.cpp +++ b/src/lib/logstore/log_stream.cpp @@ -75,7 +75,7 @@ sisl::byte_view log_stream_reader::next_group(off_t* out_dev_offset) { "we have reached the end. crc doesn't match offset {} prev crc {} header prev crc {} log_dev={}", m_vdev_jd->dev_offset(m_cur_read_bytes), header->prev_grp_crc, m_prev_crc, m_vdev_jd->logdev_id()); *out_dev_offset = m_vdev_jd->dev_offset(m_cur_read_bytes); - if (!m_vdev_jd->is_offset_at_last_chunk(m_cur_read_bytes)) { + if (!m_vdev_jd->is_offset_at_last_chunk(*out_dev_offset)) { HS_REL_ASSERT(0, "data is corrupted {}", m_vdev_jd->logdev_id()); } // move it by dma boundary if header is not valid @@ -109,7 +109,7 @@ sisl::byte_view log_stream_reader::next_group(off_t* out_dev_offset) { // move it by dma boundary if header is not valid m_prev_crc = 0; m_cur_read_bytes += m_read_size_multiple; - if (!m_vdev_jd->is_offset_at_last_chunk(m_cur_read_bytes)) { + if (!m_vdev_jd->is_offset_at_last_chunk(*out_dev_offset)) { HS_REL_ASSERT(0, "data is corrupted {}", m_vdev_jd->logdev_id()); } return ret_buf; diff --git a/src/tests/test_log_store.cpp b/src/tests/test_log_store.cpp index fd103ef47..8d5d6c17d 100644 --- a/src/tests/test_log_store.cpp +++ b/src/tests/test_log_store.cpp @@ -504,14 +504,13 @@ class SampleDB { if (!restart) { std::vector< logdev_id_t > logdev_id_vec; - for (uint32_t i{0}; i < n_log_devs; ++i) { + for (uint32_t i{0}; i < n_log_stores; ++i) { logdev_id_vec.push_back(logstore_service().create_new_logdev()); } for (uint32_t i{0}; i < n_log_stores; ++i) { - auto logdev_id = logdev_id_vec[rand() % logdev_id_vec.size()]; m_log_store_clients.push_back(std::make_unique< SampleLogStoreClient >( - logdev_id, bind_this(SampleDB::on_log_insert_completion, 3))); + logdev_id_vec[i], bind_this(SampleDB::on_log_insert_completion, 3))); } SampleLogStoreClient::s_max_flush_multiple = logstore_service().get_logdev(logdev_id_vec[0])->get_flush_size_multiple();