From b59b7570cf2f43e3dbcf4765c7c4db25d3443721 Mon Sep 17 00:00:00 2001 From: ricky Date: Mon, 27 Sep 2021 10:37:09 -0700 Subject: [PATCH] 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 --- table/format.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/table/format.cc b/table/format.cc index 5e0307b59..6abe2a4cb 100644 --- a/table/format.cc +++ b/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);