Skip to content

Commit

Permalink
Fix recycled WAL detection with kSetCompressionType record
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkr committed May 10, 2024
1 parent 7d9642d commit 2d618bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions db/log_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,11 @@ unsigned int Reader::ReadPhysicalRecord(Slice* result, size_t* drop_size,
type == kRecyclableUserDefinedTimestampSizeType);
if (is_recyclable_type) {
header_size = kRecyclableHeaderSize;
if (end_of_buffer_offset_ - buffer_.size() == 0) {
recycled_ = true;
if (!first_record_read_ && !recycled_) {
// A recycled log should have started with a recycled record
return kBadRecord;
}
recycled_ = true;
// We need enough for the larger header
if (buffer_.size() < static_cast<size_t>(kRecyclableHeaderSize)) {
int r = kEof;
Expand Down

0 comments on commit 2d618bc

Please sign in to comment.