mirror of https://github.com/facebook/rocksdb.git
sst_dump: Error message should include the case that compression algorithms are not supported.
Summary: It took me almost a day to debug this. :( Although I got to learn the file format as a by-product, this time could be saved if we have better error messages. Test Plan: gmake clean all; sst_dump --hex --file=000005.sst Reviewers: dhruba Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D7551
This commit is contained in:
parent
551f01fb23
commit
7521a225d1
|
@ -120,15 +120,17 @@ Status ReadBlock(RandomAccessFile* file,
|
|||
break;
|
||||
case kSnappyCompression: {
|
||||
size_t ulength = 0;
|
||||
static char snappy_corrupt_msg[] =
|
||||
"Snappy not supported or corrupted Snappy compressed block contents";
|
||||
if (!port::Snappy_GetUncompressedLength(data, n, &ulength)) {
|
||||
delete[] buf;
|
||||
return Status::Corruption("corrupted compressed block contents");
|
||||
return Status::Corruption(snappy_corrupt_msg);
|
||||
}
|
||||
ubuf = new char[ulength];
|
||||
if (!port::Snappy_Uncompress(data, n, ubuf)) {
|
||||
delete[] buf;
|
||||
delete[] ubuf;
|
||||
return Status::Corruption("corrupted compressed block contents");
|
||||
return Status::Corruption(snappy_corrupt_msg);
|
||||
}
|
||||
delete[] buf;
|
||||
result->data = Slice(ubuf, ulength);
|
||||
|
@ -138,9 +140,11 @@ Status ReadBlock(RandomAccessFile* file,
|
|||
}
|
||||
case kZlibCompression:
|
||||
ubuf = port::Zlib_Uncompress(data, n, &decompress_size);
|
||||
static char zlib_corrupt_msg[] =
|
||||
"Zlib not supported or corrupted Zlib compressed block contents";
|
||||
if (!ubuf) {
|
||||
delete[] buf;
|
||||
return Status::Corruption("corrupted compressed block contents");
|
||||
return Status::Corruption(zlib_corrupt_msg);
|
||||
}
|
||||
delete[] buf;
|
||||
result->data = Slice(ubuf, decompress_size);
|
||||
|
@ -149,9 +153,11 @@ Status ReadBlock(RandomAccessFile* file,
|
|||
break;
|
||||
case kBZip2Compression:
|
||||
ubuf = port::BZip2_Uncompress(data, n, &decompress_size);
|
||||
static char bzip2_corrupt_msg[] =
|
||||
"Bzip2 not supported or corrupted Bzip2 compressed block contents";
|
||||
if (!ubuf) {
|
||||
delete[] buf;
|
||||
return Status::Corruption("corrupted compressed block contents");
|
||||
return Status::Corruption(bzip2_corrupt_msg);
|
||||
}
|
||||
delete[] buf;
|
||||
result->data = Slice(ubuf, decompress_size);
|
||||
|
|
Loading…
Reference in New Issue