More clear error message on uncompressing block (#8934)

Summary:
The origin error message of uncompressing block is confusing, which may result from either build support or data corruption.

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

Reviewed By: ltamasi

Differential Revision: D31112588

Pulled By: pdillinger

fbshipit-source-id: 1cbf2d4fbcb0ef376cf942246d06f48cb603f852
main
ricky 3 years ago committed by Facebook GitHub Bot
parent e0f697d2bd
commit b59b7570cf
  1. 12
      table/format.cc

@ -360,9 +360,15 @@ Status UncompressBlockContentsForCompressionType(
UncompressData(uncompression_info, data, n, &uncompressed_size,
GetCompressFormatForVersion(format_version), allocator);
if (!ubuf) {
return Status::Corruption(
"Unsupported compression method or corrupted compressed block contents",
CompressionTypeToString(uncompression_info.type()));
if (!CompressionTypeSupported(uncompression_info.type())) {
return Status::NotSupported(
"Unsupported compression method for this build",
CompressionTypeToString(uncompression_info.type()));
} else {
return Status::Corruption(
"Corrupted compressed block contents",
CompressionTypeToString(uncompression_info.type()));
}
}
*contents = BlockContents(std::move(ubuf), uncompressed_size);

Loading…
Cancel
Save