Turn the compression_type check in BlobDBImpl::DecompressSlice into an assertion (#7127)

Summary:
In both cases where `BlobDBImpl::DecompressSlice` is called,
`compression_type` is already checked at the call site; thus, the check
inside the method is redundant and can be turned into an assertion.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7127

Test Plan: `make check`

Reviewed By: zhichao-cao

Differential Revision: D22533454

Pulled By: ltamasi

fbshipit-source-id: ae524443fc6abe0a5fb12327a3fe761a9cd2c831
main
Levi Tamasi 4 years ago committed by Facebook GitHub Bot
parent afb6bb1df2
commit ee8c79d40d
  1. 9
      utilities/blob_db/blob_db_impl.cc

@ -1148,13 +1148,13 @@ Slice BlobDBImpl::GetCompressedSlice(const Slice& raw,
Status BlobDBImpl::DecompressSlice(const Slice& compressed_value,
CompressionType compression_type,
PinnableSlice* value_output) const {
if (compression_type != kNoCompression) {
assert(compression_type != kNoCompression);
BlockContents contents;
auto cfh = static_cast<ColumnFamilyHandleImpl*>(DefaultColumnFamily());
{
StopWatch decompression_sw(env_, statistics_,
BLOB_DB_DECOMPRESSION_MICROS);
StopWatch decompression_sw(env_, statistics_, BLOB_DB_DECOMPRESSION_MICROS);
UncompressionContext context(compression_type);
UncompressionInfo info(context, UncompressionDict::GetEmptyDict(),
compression_type);
@ -1165,8 +1165,9 @@ Status BlobDBImpl::DecompressSlice(const Slice& compressed_value,
return Status::Corruption("Unable to decompress blob.");
}
}
value_output->PinSelf(contents.data);
}
return Status::OK();
}

Loading…
Cancel
Save