Fix db_bench build break with blob db

Summary:
Lite build does not recognize FLAGS_use_blob_db. Fixing it.
Closes https://github.com/facebook/rocksdb/pull/2372

Reviewed By: anirbanr-fb

Differential Revision: D5130773

Pulled By: yiwu-arbug

fbshipit-source-id: 43131d9d0be5811f2129af562be72cca26369cb3
This commit is contained in:
Yi Wu 2017-05-25 14:08:16 -07:00
parent 0ccaba2a05
commit 8c1f5c254f

View File

@ -1804,6 +1804,7 @@ class Benchmark {
int64_t readwrites_;
int64_t merge_keys_;
bool report_file_operations_;
bool use_blob_db_;
bool SanityCheck() {
if (FLAGS_compression_ratio > 1) {
@ -2063,7 +2064,12 @@ class Benchmark {
? FLAGS_num
: ((FLAGS_writes > FLAGS_reads) ? FLAGS_writes : FLAGS_reads)),
merge_keys_(FLAGS_merge_keys < 0 ? FLAGS_num : FLAGS_merge_keys),
report_file_operations_(FLAGS_report_file_operations) {
report_file_operations_(FLAGS_report_file_operations),
#ifndef ROCKSDB_LITE
use_blob_db_(FLAGS_use_blob_db) {
#else
use_blob_db_(false) {
#endif // !ROCKSDB_LITE
// use simcache instead of cache
if (FLAGS_simcache_size >= 0) {
if (FLAGS_cache_numshardbits >= 1) {
@ -3416,13 +3422,14 @@ void VerifyDBFromDB(std::string& truth_db_name) {
for (int64_t j = 0; j < entries_per_batch_; j++) {
int64_t rand_num = key_gens[id]->Next();
GenerateKeyFromInt(rand_num, FLAGS_num, &key);
if (FLAGS_use_blob_db) {
if (use_blob_db_) {
#ifndef ROCKSDB_LITE
Slice val = gen.Generate(value_size_);
int ttl = rand() % 86400;
blob_db::BlobDB* blobdb =
static_cast<blob_db::BlobDB*>(db_with_cfh->db);
s = blobdb->PutWithTTL(write_options_, key, val, ttl);
#endif // ROCKSDB_LITE
} else if (FLAGS_num_column_families <= 1) {
batch.Put(key, gen.Generate(value_size_));
} else {
@ -3444,9 +3451,11 @@ void VerifyDBFromDB(std::string& truth_db_name) {
++offset) {
GenerateKeyFromInt(begin_num + offset, FLAGS_num,
&expanded_keys[offset]);
if (FLAGS_use_blob_db) {
if (use_blob_db_) {
#ifndef ROCKSDB_LITE
s = db_with_cfh->db->Delete(write_options_,
expanded_keys[offset]);
#endif // ROCKSDB_LITE
} else if (FLAGS_num_column_families <= 1) {
batch.Delete(expanded_keys[offset]);
} else {
@ -3458,10 +3467,12 @@ void VerifyDBFromDB(std::string& truth_db_name) {
GenerateKeyFromInt(begin_num, FLAGS_num, &begin_key);
GenerateKeyFromInt(begin_num + range_tombstone_width_, FLAGS_num,
&end_key);
if (FLAGS_use_blob_db) {
if (use_blob_db_) {
#ifndef ROCKSDB_LITE
s = db_with_cfh->db->DeleteRange(
write_options_, db_with_cfh->db->DefaultColumnFamily(),
begin_key, end_key);
#endif // ROCKSDB_LITE
} else if (FLAGS_num_column_families <= 1) {
batch.DeleteRange(begin_key, end_key);
} else {
@ -3471,8 +3482,10 @@ void VerifyDBFromDB(std::string& truth_db_name) {
}
}
}
if (!FLAGS_use_blob_db) {
if (!use_blob_db_) {
#ifndef ROCKSDB_LITE
s = db_with_cfh->db->Write(write_options_, &batch);
#endif // ROCKSDB_LITE
}
thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db,
entries_per_batch_, kWrite);