sst_dump won't print size for unsupported compression type

main
Patrick Chan 9 years ago committed by Siying Dong
parent 6e801b0bd1
commit cba752d588
  1. 23
      tools/sst_dump_tool.cc

@ -34,6 +34,7 @@
#include "table/plain_table_factory.h" #include "table/plain_table_factory.h"
#include "tools/ldb_cmd.h" #include "tools/ldb_cmd.h"
#include "util/random.h" #include "util/random.h"
#include "util/compression.h"
#include "port/port.h" #include "port/port.h"
@ -194,15 +195,19 @@ int SstFileReader::ShowAllCompressionSizes(size_t block_size) {
}; };
for (auto& i : compressions) { for (auto& i : compressions) {
CompressionOptions compress_opt; if (CompressionTypeSupported(i.first)) {
std::string column_family_name; CompressionOptions compress_opt;
TableBuilderOptions tb_opts(imoptions, ikc, &block_based_table_factories, std::string column_family_name;
i.first, compress_opt, TableBuilderOptions tb_opts(imoptions, ikc, &block_based_table_factories,
nullptr /* compression_dict */, i.first, compress_opt,
false /* skip_filters */, column_family_name); nullptr /* compression_dict */,
uint64_t file_size = CalculateCompressedTableSize(tb_opts, block_size); false /* skip_filters */, column_family_name);
fprintf(stdout, "Compression: %s", i.second); uint64_t file_size = CalculateCompressedTableSize(tb_opts, block_size);
fprintf(stdout, " Size: %" PRIu64 "\n", file_size); fprintf(stdout, "Compression: %s", i.second);
fprintf(stdout, " Size: %" PRIu64 "\n", file_size);
} else {
fprintf(stdout, "Unsupported compression type: %s.\n", i.second);
}
} }
return 0; return 0;
} }

Loading…
Cancel
Save