Fix build issues

main
Igor Canadi 10 years ago
parent abb9b95ffe
commit 15d2abbec3
  1. 79
      db/db_bench.cc
  2. 11
      db/db_test.cc
  3. 20
      table/table_test.cc

@ -45,6 +45,7 @@ int main() {
#include "port/port.h" #include "port/port.h"
#include "port/stack_trace.h" #include "port/stack_trace.h"
#include "util/crc32c.h" #include "util/crc32c.h"
#include "util/compression.h"
#include "util/histogram.h" #include "util/histogram.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/random.h" #include "util/random.h"
@ -1213,27 +1214,27 @@ class Benchmark {
text[len] = '\0'; text[len] = '\0';
switch (FLAGS_compression_type_e) { switch (FLAGS_compression_type_e) {
case kSnappyCompression: case kSnappyCompression:
result = port::Snappy_Compress(Options().compression_opts, text, result = Snappy_Compress(Options().compression_opts, text,
strlen(text), &compressed); strlen(text), &compressed);
name = "Snappy"; name = "Snappy";
break; break;
case kZlibCompression: case kZlibCompression:
result = port::Zlib_Compress(Options().compression_opts, text, result = Zlib_Compress(Options().compression_opts, text, strlen(text),
strlen(text), &compressed); &compressed);
name = "Zlib"; name = "Zlib";
break; break;
case kBZip2Compression: case kBZip2Compression:
result = port::BZip2_Compress(Options().compression_opts, text, result = BZip2_Compress(Options().compression_opts, text,
strlen(text), &compressed); strlen(text), &compressed);
name = "BZip2"; name = "BZip2";
break; break;
case kLZ4Compression: case kLZ4Compression:
result = port::LZ4_Compress(Options().compression_opts, text, result = LZ4_Compress(Options().compression_opts, text, strlen(text),
strlen(text), &compressed); &compressed);
name = "LZ4"; name = "LZ4";
break; break;
case kLZ4HCCompression: case kLZ4HCCompression:
result = port::LZ4HC_Compress(Options().compression_opts, text, result = LZ4HC_Compress(Options().compression_opts, text,
strlen(text), &compressed); strlen(text), &compressed);
name = "LZ4HC"; name = "LZ4HC";
break; break;
@ -1774,24 +1775,24 @@ class Benchmark {
while (ok && bytes < int64_t(1) << 30) { while (ok && bytes < int64_t(1) << 30) {
switch (FLAGS_compression_type_e) { switch (FLAGS_compression_type_e) {
case rocksdb::kSnappyCompression: case rocksdb::kSnappyCompression:
ok = port::Snappy_Compress(Options().compression_opts, input.data(), ok = Snappy_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
case rocksdb::kZlibCompression: case rocksdb::kZlibCompression:
ok = port::Zlib_Compress(Options().compression_opts, input.data(), ok = Zlib_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
case rocksdb::kBZip2Compression: case rocksdb::kBZip2Compression:
ok = port::BZip2_Compress(Options().compression_opts, input.data(), ok = BZip2_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
case rocksdb::kLZ4Compression: case rocksdb::kLZ4Compression:
ok = port::LZ4_Compress(Options().compression_opts, input.data(), ok = LZ4_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
case rocksdb::kLZ4HCCompression: case rocksdb::kLZ4HCCompression:
ok = port::LZ4HC_Compress(Options().compression_opts, input.data(), ok = LZ4HC_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
default: default:
ok = false; ok = false;
@ -1820,24 +1821,24 @@ class Benchmark {
bool ok; bool ok;
switch (FLAGS_compression_type_e) { switch (FLAGS_compression_type_e) {
case rocksdb::kSnappyCompression: case rocksdb::kSnappyCompression:
ok = port::Snappy_Compress(Options().compression_opts, input.data(), ok = Snappy_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
case rocksdb::kZlibCompression: case rocksdb::kZlibCompression:
ok = port::Zlib_Compress(Options().compression_opts, input.data(), ok = Zlib_Compress(Options().compression_opts, input.data(), input.size(),
input.size(), &compressed); &compressed);
break; break;
case rocksdb::kBZip2Compression: case rocksdb::kBZip2Compression:
ok = port::BZip2_Compress(Options().compression_opts, input.data(), ok = BZip2_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
case rocksdb::kLZ4Compression: case rocksdb::kLZ4Compression:
ok = port::LZ4_Compress(Options().compression_opts, input.data(), ok = LZ4_Compress(Options().compression_opts, input.data(), input.size(),
input.size(), &compressed); &compressed);
break; break;
case rocksdb::kLZ4HCCompression: case rocksdb::kLZ4HCCompression:
ok = port::LZ4HC_Compress(Options().compression_opts, input.data(), ok = LZ4HC_Compress(Options().compression_opts, input.data(),
input.size(), &compressed); input.size(), &compressed);
break; break;
default: default:
ok = false; ok = false;
@ -1851,27 +1852,27 @@ class Benchmark {
case rocksdb::kSnappyCompression: case rocksdb::kSnappyCompression:
// allocate here to make comparison fair // allocate here to make comparison fair
uncompressed = new char[input.size()]; uncompressed = new char[input.size()];
ok = port::Snappy_Uncompress(compressed.data(), compressed.size(), ok = Snappy_Uncompress(compressed.data(), compressed.size(),
uncompressed); uncompressed);
break; break;
case rocksdb::kZlibCompression: case rocksdb::kZlibCompression:
uncompressed = port::Zlib_Uncompress( uncompressed = Zlib_Uncompress(compressed.data(), compressed.size(),
compressed.data(), compressed.size(), &decompress_size); &decompress_size);
ok = uncompressed != nullptr; ok = uncompressed != nullptr;
break; break;
case rocksdb::kBZip2Compression: case rocksdb::kBZip2Compression:
uncompressed = port::BZip2_Uncompress( uncompressed = BZip2_Uncompress(compressed.data(), compressed.size(),
compressed.data(), compressed.size(), &decompress_size); &decompress_size);
ok = uncompressed != nullptr; ok = uncompressed != nullptr;
break; break;
case rocksdb::kLZ4Compression: case rocksdb::kLZ4Compression:
uncompressed = port::LZ4_Uncompress( uncompressed = LZ4_Uncompress(compressed.data(), compressed.size(),
compressed.data(), compressed.size(), &decompress_size); &decompress_size);
ok = uncompressed != nullptr; ok = uncompressed != nullptr;
break; break;
case rocksdb::kLZ4HCCompression: case rocksdb::kLZ4HCCompression:
uncompressed = port::LZ4_Uncompress( uncompressed = LZ4_Uncompress(compressed.data(), compressed.size(),
compressed.data(), compressed.size(), &decompress_size); &decompress_size);
ok = uncompressed != nullptr; ok = uncompressed != nullptr;
break; break;
default: default:

@ -42,6 +42,7 @@
#include "util/hash_linklist_rep.h" #include "util/hash_linklist_rep.h"
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
#include "util/logging.h" #include "util/logging.h"
#include "util/compression.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/rate_limiter.h" #include "util/rate_limiter.h"
#include "util/statistics.h" #include "util/statistics.h"
@ -58,31 +59,31 @@ namespace rocksdb {
static bool SnappyCompressionSupported(const CompressionOptions& options) { static bool SnappyCompressionSupported(const CompressionOptions& options) {
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::Snappy_Compress(options, in.data(), in.size(), &out); return Snappy_Compress(options, in.data(), in.size(), &out);
} }
static bool ZlibCompressionSupported(const CompressionOptions& options) { static bool ZlibCompressionSupported(const CompressionOptions& options) {
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::Zlib_Compress(options, in.data(), in.size(), &out); return Zlib_Compress(options, in.data(), in.size(), &out);
} }
static bool BZip2CompressionSupported(const CompressionOptions& options) { static bool BZip2CompressionSupported(const CompressionOptions& options) {
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::BZip2_Compress(options, in.data(), in.size(), &out); return BZip2_Compress(options, in.data(), in.size(), &out);
} }
static bool LZ4CompressionSupported(const CompressionOptions &options) { static bool LZ4CompressionSupported(const CompressionOptions &options) {
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::LZ4_Compress(options, in.data(), in.size(), &out); return LZ4_Compress(options, in.data(), in.size(), &out);
} }
static bool LZ4HCCompressionSupported(const CompressionOptions &options) { static bool LZ4HCCompressionSupported(const CompressionOptions &options) {
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::LZ4HC_Compress(options, in.data(), in.size(), &out); return LZ4HC_Compress(options, in.data(), in.size(), &out);
} }
static std::string RandomString(Random* rnd, int len) { static std::string RandomString(Random* rnd, int len) {

@ -40,6 +40,7 @@
#include "table/plain_table_factory.h" #include "table/plain_table_factory.h"
#include "table/get_context.h" #include "table/get_context.h"
#include "util/compression.h"
#include "util/random.h" #include "util/random.h"
#include "util/statistics.h" #include "util/statistics.h"
#include "util/testharness.h" #include "util/testharness.h"
@ -533,9 +534,8 @@ static bool SnappyCompressionSupported() {
#ifdef SNAPPY #ifdef SNAPPY
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::Snappy_Compress(Options().compression_opts, return Snappy_Compress(Options().compression_opts, in.data(), in.size(),
in.data(), in.size(), &out);
&out);
#else #else
return false; return false;
#endif #endif
@ -545,9 +545,7 @@ static bool ZlibCompressionSupported() {
#ifdef ZLIB #ifdef ZLIB
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::Zlib_Compress(Options().compression_opts, return Zlib_Compress(Options().compression_opts, in.data(), in.size(), &out);
in.data(), in.size(),
&out);
#else #else
return false; return false;
#endif #endif
@ -557,9 +555,7 @@ static bool BZip2CompressionSupported() {
#ifdef BZIP2 #ifdef BZIP2
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::BZip2_Compress(Options().compression_opts, return BZip2_Compress(Options().compression_opts, in.data(), in.size(), &out);
in.data(), in.size(),
&out);
#else #else
return false; return false;
#endif #endif
@ -569,8 +565,7 @@ static bool LZ4CompressionSupported() {
#ifdef LZ4 #ifdef LZ4
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::LZ4_Compress(Options().compression_opts, in.data(), in.size(), return LZ4_Compress(Options().compression_opts, in.data(), in.size(), &out);
&out);
#else #else
return false; return false;
#endif #endif
@ -580,8 +575,7 @@ static bool LZ4HCCompressionSupported() {
#ifdef LZ4 #ifdef LZ4
std::string out; std::string out;
Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
return port::LZ4HC_Compress(Options().compression_opts, in.data(), in.size(), return LZ4HC_Compress(Options().compression_opts, in.data(), in.size(), &out);
&out);
#else #else
return false; return false;
#endif #endif

Loading…
Cancel
Save