break;
}
- if (!invalid &&
- !advance_to_last_pad_byte(m_read_bl_off + iter.get_off(), &iter,
+ if (!advance_to_last_pad_byte(m_read_bl_off + iter.get_off(), &iter,
&pad_len, &partial_entry)) {
invalid_start_off = m_read_bl_off + bl_off;
invalid = true;
ldout(m_cct, 20) << ": partial pad detected, will re-fetch"
<< dendl;
}
- break;
+ } else {
+ lderr(m_cct) << ": detected corrupt journal entry at offset "
+ << invalid_start_off << dendl;
}
- lderr(m_cct) << ": detected corrupt journal entry at offset "
- << invalid_start_off << dendl;
+ break;
}
++iter;
continue;
journal::Entry entry1(234, 123, this->create_payload(std::string(24, '1')));
journal::Entry entry2(234, 124, this->create_payload(std::string(24, '2')));
- journal::Entry entry3(234, 125, this->create_payload(std::string(24, '3')));
bufferlist bl;
encode(entry1, bl);
encode(this->create_payload("corruption" + std::string(1024, 'X')), bl);
encode(entry2, bl);
- encode(this->create_payload("corruption" + std::string(1024, 'Y')), bl);
- encode(entry3, bl);
ASSERT_EQ(0, this->append(this->get_object_name(oid), bl));
journal::ObjectPlayerPtr object = this->create_object(oid, 14);
ASSERT_EQ(-EBADMSG, this->fetch(object));
- ASSERT_EQ(0, this->fetch(object));
journal::ObjectPlayer::Entries entries;
object->get_entries(&entries);
- ASSERT_EQ(3U, entries.size());
+ ASSERT_EQ(1U, entries.size());
- journal::ObjectPlayer::Entries expected_entries = {entry1, entry2, entry3};
+ journal::ObjectPlayer::Entries expected_entries = {entry1};
ASSERT_EQ(expected_entries, entries);
}