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
This commit is contained in:
parent
afb6bb1df2
commit
ee8c79d40d
@ -1148,25 +1148,26 @@ Slice BlobDBImpl::GetCompressedSlice(const Slice& raw,
|
||||
Status BlobDBImpl::DecompressSlice(const Slice& compressed_value,
|
||||
CompressionType compression_type,
|
||||
PinnableSlice* value_output) const {
|
||||
if (compression_type != kNoCompression) {
|
||||
BlockContents contents;
|
||||
auto cfh = static_cast<ColumnFamilyHandleImpl*>(DefaultColumnFamily());
|
||||
assert(compression_type != kNoCompression);
|
||||
|
||||
{
|
||||
StopWatch decompression_sw(env_, statistics_,
|
||||
BLOB_DB_DECOMPRESSION_MICROS);
|
||||
UncompressionContext context(compression_type);
|
||||
UncompressionInfo info(context, UncompressionDict::GetEmptyDict(),
|
||||
compression_type);
|
||||
Status s = UncompressBlockContentsForCompressionType(
|
||||
info, compressed_value.data(), compressed_value.size(), &contents,
|
||||
kBlockBasedTableVersionFormat, *(cfh->cfd()->ioptions()));
|
||||
if (!s.ok()) {
|
||||
return Status::Corruption("Unable to decompress blob.");
|
||||
}
|
||||
BlockContents contents;
|
||||
auto cfh = static_cast<ColumnFamilyHandleImpl*>(DefaultColumnFamily());
|
||||
|
||||
{
|
||||
StopWatch decompression_sw(env_, statistics_, BLOB_DB_DECOMPRESSION_MICROS);
|
||||
UncompressionContext context(compression_type);
|
||||
UncompressionInfo info(context, UncompressionDict::GetEmptyDict(),
|
||||
compression_type);
|
||||
Status s = UncompressBlockContentsForCompressionType(
|
||||
info, compressed_value.data(), compressed_value.size(), &contents,
|
||||
kBlockBasedTableVersionFormat, *(cfh->cfd()->ioptions()));
|
||||
if (!s.ok()) {
|
||||
return Status::Corruption("Unable to decompress blob.");
|
||||
}
|
||||
value_output->PinSelf(contents.data);
|
||||
}
|
||||
|
||||
value_output->PinSelf(contents.data);
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user