Skip to content

Commit

Permalink
Fix test of last chunk when recovery of logstore. (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanebay authored May 8, 2024
1 parent 97cba11 commit 74ca779
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/logstore/log_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/tests/test_log_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 74ca779

Please sign in to comment.