// Compute the crc of the record type and the payload.
uint32_t crc = crc32c::Extend(type_crc_[t], ptr, n);
- crc = crc32c::Mask(crc); // Adjust for storage
- EncodeFixed32(buf, crc);
+ if (db_options_->recycle_log_files) {
+ uint32_t final_crc = crc ^ log_number_; // XOR in log numb
+ final_crc = crc32c::Mask(final_crc); // Adjust for storage
+ EncodeFixed32(buf, final_crc);
+ } else {
+ crc = crc32c::Mask(crc); // Adjust for storage
+ EncodeFixed32(buf, crc);
+ }
// Write the header and the payload
Status s = dest_->Append(Slice(buf, kHeaderSize));