From 7506198da25273d0323be2a8db89390d85dc138c Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 21:14:18 +0200 Subject: [PATCH 01/20] cuckoo_table_db_test.cc: add flush after delete It seems that a FlushMemTable() call is needed in the Uint64Comparator test after call Delete(). Otherwise the later via Put() added keys get lost with the next FlushMemTable() call before the check. Signed-off-by: Danny Al-Gaaf --- db/cuckoo_table_db_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/db/cuckoo_table_db_test.cc b/db/cuckoo_table_db_test.cc index 2652d1776..4beee59e4 100644 --- a/db/cuckoo_table_db_test.cc +++ b/db/cuckoo_table_db_test.cc @@ -218,6 +218,7 @@ TEST(CuckooTableDBTest, Uint64Comparator) { // Add more keys. ASSERT_OK(Delete(Uint64Key(2))); // Delete. + dbfull()->TEST_FlushMemTable(); ASSERT_OK(Put(Uint64Key(3), "v0")); // Update. ASSERT_OK(Put(Uint64Key(4), "v4")); dbfull()->TEST_FlushMemTable(); From 68ca534169a4f9e1930f6511109e973b43cf5998 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 17:43:47 +0200 Subject: [PATCH 02/20] corruption_test.cc: pass parameter by reference Fix for: [db/corruption_test.cc:134]: (performance) Function parameter 'fname' should be passed by reference. Signed-off-by: Danny Al-Gaaf --- db/corruption_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/corruption_test.cc b/db/corruption_test.cc index 09d78f89f..4fcea0d5a 100644 --- a/db/corruption_test.cc +++ b/db/corruption_test.cc @@ -131,7 +131,7 @@ class CorruptionTest { ASSERT_GE(max_expected, correct); } - void CorruptFile(const std::string fname, int offset, int bytes_to_corrupt) { + void CorruptFile(const std::string& fname, int offset, int bytes_to_corrupt) { struct stat sbuf; if (stat(fname.c_str(), &sbuf) != 0) { const char* msg = strerror(errno); From 53910ddb152fbcba95a3e04b058a997c40f654ae Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 18:01:23 +0200 Subject: [PATCH 03/20] db_test.cc: pass parameter by reference Fix for: [db/db_test.cc:6141]: (performance) Function parameter 'key' should be passed by reference. Signed-off-by: Danny Al-Gaaf --- db/db_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_test.cc b/db/db_test.cc index c09cc74df..986d5810e 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -6138,7 +6138,7 @@ class WrappedBloom : public FilterPolicy { const FilterPolicy* filter_; mutable uint32_t counter_; - rocksdb::Slice convertKey(const rocksdb::Slice key) const { + rocksdb::Slice convertKey(const rocksdb::Slice& key) const { return key; } }; From 8ce050b51b1abb226a97573fe9b48916342ec29f Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 18:03:12 +0200 Subject: [PATCH 04/20] table/bloom_block.*: pass func parameter by reference [table/bloom_block.h:29]: (performance) Function parameter 'keys_hashes' should be passed by reference. Signed-off-by: Danny Al-Gaaf --- table/bloom_block.cc | 2 +- table/bloom_block.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/table/bloom_block.cc b/table/bloom_block.cc index c44ab66ca..cfea8a2c5 100644 --- a/table/bloom_block.cc +++ b/table/bloom_block.cc @@ -11,7 +11,7 @@ namespace rocksdb { -void BloomBlockBuilder::AddKeysHashes(const std::vector keys_hashes) { +void BloomBlockBuilder::AddKeysHashes(const std::vector& keys_hashes) { for (auto hash : keys_hashes) { bloom_.AddHash(hash); } diff --git a/table/bloom_block.h b/table/bloom_block.h index d55453eda..7ef5d14b6 100644 --- a/table/bloom_block.h +++ b/table/bloom_block.h @@ -26,7 +26,7 @@ class BloomBlockBuilder { uint32_t GetNumBlocks() const { return bloom_.GetNumBlocks(); } - void AddKeysHashes(const std::vector keys_hashes); + void AddKeysHashes(const std::vector& keys_hashes); Slice Finish(); From b8b7117e97e649fc65d0a4dd397caf9a39fb71b1 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 18:04:44 +0200 Subject: [PATCH 05/20] db/version_set.cc: use !empty() instead of 'size() > 0' Use empty() since it should be prefered as it has, following the standard, a constant time complexity regardless of the containter type. The same is not guaranteed for size(). Fix for: [db/version_set.cc:2250]: (performance) Possible inefficient checking for 'column_families_not_found' emptiness. Signed-off-by: Danny Al-Gaaf --- db/version_set.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/version_set.cc b/db/version_set.cc index 10649fa6c..1d1d53813 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2169,7 +2169,7 @@ Status VersionSet::Recover( // there were some column families in the MANIFEST that weren't specified // in the argument. This is OK in read_only mode - if (read_only == false && column_families_not_found.size() > 0) { + if (read_only == false && !column_families_not_found.empty()) { std::string list_of_not_found; for (const auto& cf : column_families_not_found) { list_of_not_found += ", " + cf.second; From 93548ce8f451a701ad0967ba705f04fef80aa11a Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 18:12:04 +0200 Subject: [PATCH 06/20] table/cuckoo_table_reader.cc: pass func parameter by ref Fix for: [table/cuckoo_table_reader.cc:198]: (performance) Function parameter 'file_data' should be passed by reference. Signed-off-by: Danny Al-Gaaf --- table/cuckoo_table_reader.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/table/cuckoo_table_reader.cc b/table/cuckoo_table_reader.cc index f8da4e288..f39900add 100644 --- a/table/cuckoo_table_reader.cc +++ b/table/cuckoo_table_reader.cc @@ -191,7 +191,7 @@ class CuckooTableIterator : public Iterator { private: struct BucketComparator { - BucketComparator(const Slice file_data, const Comparator* ucomp, + BucketComparator(const Slice& file_data, const Comparator* ucomp, uint32_t bucket_len, uint32_t user_key_len, const Slice target = Slice()) : file_data_(file_data), From 063471bf7613544496a4d4b5a1e1ba4a7aa605cf Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 18:14:05 +0200 Subject: [PATCH 07/20] table/table_test.cc: pass func parameter by reference Fix for: [table/table_test.cc:1218]: (performance) Function parameter 'prefix' should be passed by reference. Signed-off-by: Danny Al-Gaaf --- table/table_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/table/table_test.cc b/table/table_test.cc index 1b032db53..df662ad88 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -1216,7 +1216,7 @@ static std::string RandomString(Random* rnd, int len) { return r; } -void AddInternalKey(TableConstructor* c, const std::string prefix, +void AddInternalKey(TableConstructor* c, const std::string& prefix, int suffix_len = 800) { static Random rnd(1023); InternalKey k(prefix + RandomString(&rnd, 800), 0, kTypeValue); From 8558457143bfa76d61e0d2f715e40ec2ddb6ffc2 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 19:32:46 +0200 Subject: [PATCH 08/20] ldb_cmd_execute_result.h: perform init in initialization list Fix for: [util/ldb_cmd_execute_result.h:18]: (performance) Variable 'message_' is assigned in constructor body. Consider performing initialization in initialization list. [util/ldb_cmd_execute_result.h:23]: (performance) Variable 'message_' is assigned in constructor body. Consider performing initialization in initialization list. Signed-off-by: Danny Al-Gaaf --- util/ldb_cmd_execute_result.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/util/ldb_cmd_execute_result.h b/util/ldb_cmd_execute_result.h index b9121b2b0..b8e6c4634 100644 --- a/util/ldb_cmd_execute_result.h +++ b/util/ldb_cmd_execute_result.h @@ -13,15 +13,10 @@ public: EXEC_NOT_STARTED = 0, EXEC_SUCCEED = 1, EXEC_FAILED = 2, }; - LDBCommandExecuteResult() { - state_ = EXEC_NOT_STARTED; - message_ = ""; - } + LDBCommandExecuteResult() : state_(EXEC_NOT_STARTED), message_("") {} - LDBCommandExecuteResult(State state, std::string& msg) { - state_ = state; - message_ = msg; - } + LDBCommandExecuteResult(State state, std::string& msg) : + state_(state), message_(msg) {} std::string ToString() { std::string ret; From 873f1356a1781e8d638973ea320b722d3240fc5a Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 26 Sep 2014 19:35:20 +0200 Subject: [PATCH 09/20] db_ttl_impl.h: pass func parameter by reference Fix for: [utilities/ttl/db_ttl_impl.h:209]: (performance) Function parameter 'merge_op' should be passed by reference. Signed-off-by: Danny Al-Gaaf --- utilities/ttl/db_ttl_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/ttl/db_ttl_impl.h b/utilities/ttl/db_ttl_impl.h index 84fb55568..92b8eab7f 100644 --- a/utilities/ttl/db_ttl_impl.h +++ b/utilities/ttl/db_ttl_impl.h @@ -206,7 +206,7 @@ class TtlCompactionFilterFactory : public CompactionFilterFactory { class TtlMergeOperator : public MergeOperator { public: - explicit TtlMergeOperator(const std::shared_ptr merge_op, + explicit TtlMergeOperator(const std::shared_ptr& merge_op, Env* env) : user_merge_op_(merge_op), env_(env) { assert(merge_op); From 33580fa39a0aef3d1115e47fb4f13154be5e5993 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 22:53:39 +0200 Subject: [PATCH 10/20] db/db_impl.cc: fix object handling, remove double lines Fix for: [db/db_impl.cc:4039]: (error) Instance of 'StopWatch' object is destroyed immediately. [db/db_impl.cc:4042]: (error) Instance of 'StopWatch' object is destroyed immediately. Signed-off-by: Danny Al-Gaaf --- db/db_impl.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 7f5a382c0..3bf60a2d1 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -4037,11 +4037,10 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) { RecordTick(stats_, WAL_FILE_BYTES, log_size); if (status.ok() && options.sync) { RecordTick(stats_, WAL_FILE_SYNCED); + StopWatch sw(env_, stats_, WAL_FILE_SYNC_MICROS); if (db_options_.use_fsync) { - StopWatch(env_, stats_, WAL_FILE_SYNC_MICROS); status = log_->file()->Fsync(); } else { - StopWatch(env_, stats_, WAL_FILE_SYNC_MICROS); status = log_->file()->Sync(); } } From af8c2b2d97d8473d97107bcf326a450e7700def6 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:00:18 +0200 Subject: [PATCH 11/20] util/signal_test.cc: suppress intentional null pointer deref Add comment to enabele cppcheck suppression of intentional null pointer deref via --inline-suppr option. Signed-off-by: Danny Al-Gaaf --- util/signal_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/util/signal_test.cc b/util/signal_test.cc index f51fa548e..b23ad6a98 100644 --- a/util/signal_test.cc +++ b/util/signal_test.cc @@ -9,6 +9,7 @@ namespace { void f0() { char *p = nullptr; + // cppcheck-suppress nullPointer *p = 10; /* SIGSEGV here!! */ } From 4cc8643baf5b4e4a25fb20a77b3257100747d483 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:05:12 +0200 Subject: [PATCH 12/20] util/ldb_cmd.cc: prefer prefix ++operator for non-primitive types Prefer prefix ++operator for non-primitive types like iterators for performance reasons. Prefix ++/-- operators avoid creating a temporary copy. Signed-off-by: Danny Al-Gaaf --- util/ldb_cmd.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index 9f00757b8..8eda39bf9 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -325,7 +325,7 @@ bool LDBCommand::ParseKeyValue(const string& line, string* key, string* value, bool LDBCommand::ValidateCmdLineOptions() { for (map::const_iterator itr = option_map_.begin(); - itr != option_map_.end(); itr++) { + itr != option_map_.end(); ++itr) { if (find(valid_cmd_line_options_.begin(), valid_cmd_line_options_.end(), itr->first) == valid_cmd_line_options_.end()) { @@ -335,7 +335,7 @@ bool LDBCommand::ValidateCmdLineOptions() { } for (vector::const_iterator itr = flags_.begin(); - itr != flags_.end(); itr++) { + itr != flags_.end(); ++itr) { if (find(valid_cmd_line_options_.begin(), valid_cmd_line_options_.end(), *itr) == valid_cmd_line_options_.end()) { @@ -1538,7 +1538,7 @@ void BatchPutCommand::DoCommand() { WriteBatch batch; for (vector>::const_iterator itr - = key_values_.begin(); itr != key_values_.end(); itr++) { + = key_values_.begin(); itr != key_values_.end(); ++itr) { batch.Put(itr->first, itr->second); } Status st = db_->Write(WriteOptions(), &batch); From 0de452ee9f8afa9cae2a72b8fb3c3dd59b28a9d9 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:09:28 +0200 Subject: [PATCH 13/20] document_db.cc: pass const parameter by reference Signed-off-by: Danny Al-Gaaf --- utilities/document/document_db.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/document/document_db.cc b/utilities/document/document_db.cc index 8e15a52ca..b9157f274 100644 --- a/utilities/document/document_db.cc +++ b/utilities/document/document_db.cc @@ -376,7 +376,7 @@ class IndexKey { class SimpleSortedIndex : public Index { public: - SimpleSortedIndex(const std::string field, const std::string& name) + SimpleSortedIndex(const std::string& field, const std::string& name) : field_(field), name_(name) {} virtual const char* Name() const override { return name_.c_str(); } From 43c789c8f246a2a35864e3fca9585b55c40c2095 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:11:00 +0200 Subject: [PATCH 14/20] spatialdb/spatial_db.cc: use !empty() instead of 'size() > 0' Use empty() since it should be prefered as it has, following the standard, a constant time complexity regardless of the containter type. The same is not guaranteed for size(). Signed-off-by: Danny Al-Gaaf --- utilities/spatialdb/spatial_db.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/spatialdb/spatial_db.cc b/utilities/spatialdb/spatial_db.cc index 9c44027c8..6fbb780bc 100644 --- a/utilities/spatialdb/spatial_db.cc +++ b/utilities/spatialdb/spatial_db.cc @@ -369,7 +369,7 @@ class SpatialIndexCursor : public Cursor { } delete spatial_iterator; - valid_ = valid_ && primary_key_ids_.size() > 0; + valid_ = valid_ && !primary_key_ids_.empty(); if (valid_) { primary_keys_iterator_ = primary_key_ids_.begin(); From b140375565878fb59235bfd2673913b96ae021fe Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:13:01 +0200 Subject: [PATCH 15/20] ttl/ttl_test.cc: prefer prefix ++operator for non-primitive types Signed-off-by: Danny Al-Gaaf --- utilities/ttl/ttl_test.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities/ttl/ttl_test.cc b/utilities/ttl/ttl_test.cc index e6d64e54e..66cabe8e3 100644 --- a/utilities/ttl/ttl_test.cc +++ b/utilities/ttl/ttl_test.cc @@ -120,7 +120,7 @@ class TtlTest { static FlushOptions flush_opts; WriteBatch batch; kv_it_ = kvmap_.begin(); - for (int i = 0; i < num_ops && kv_it_ != kvmap_.end(); i++, kv_it_++) { + for (int i = 0; i < num_ops && kv_it_ != kvmap_.end(); i++, ++kv_it_) { switch (batch_ops[i]) { case PUT: batch.Put(kv_it_->first, kv_it_->second); @@ -145,7 +145,7 @@ class TtlTest { static FlushOptions flush_opts; kv_it_ = kvmap_.begin(); advance(kv_it_, start_pos_map); - for (int i = 0; kv_it_ != kvmap_.end() && i < num_entries; i++, kv_it_++) { + for (int i = 0; kv_it_ != kvmap_.end() && i < num_entries; i++, ++kv_it_) { ASSERT_OK(cf == nullptr ? db_ttl_->Put(wopts, kv_it_->first, kv_it_->second) : db_ttl_->Put(wopts, cf, kv_it_->first, kv_it_->second)); @@ -207,7 +207,7 @@ class TtlTest { kv_it_ = kvmap_.begin(); advance(kv_it_, st_pos); std::string v; - for (int i = 0; kv_it_ != kvmap_.end() && i < span; i++, kv_it_++) { + for (int i = 0; kv_it_ != kvmap_.end() && i < span; i++, ++kv_it_) { Status s = (cf == nullptr) ? db_ttl_->Get(ropts, kv_it_->first, &v) : db_ttl_->Get(ropts, cf, kv_it_->first, &v); if (s.ok() != check) { @@ -252,7 +252,7 @@ class TtlTest { } else { // dbiter should have found out kvmap_[st_pos] for (int i = st_pos; kv_it_ != kvmap_.end() && i < st_pos + span; - i++, kv_it_++) { + i++, ++kv_it_) { ASSERT_TRUE(dbiter->Valid()); ASSERT_EQ(dbiter->value().compare(kv_it_->second), 0); dbiter->Next(); From d517c836483b2017ec7d64997fb7a331fdb5f150 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:23:09 +0200 Subject: [PATCH 16/20] in_table_factory.cc: use correct format specifier Use %zu instead of %zd since size_t and uint32_t are unsigned. Fix for: [table/plain_table_factory.cc:55]: (warning) %zd in format string (no. 1) requires 'ssize_t' but the argument type is 'size_t {aka unsigned long}'. [table/plain_table_factory.cc:58]: (warning) %zd in format string (no. 1) requires 'ssize_t' but the argument type is 'size_t {aka unsigned long}'. Signed-off-by: Danny Al-Gaaf --- table/plain_table_factory.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/table/plain_table_factory.cc b/table/plain_table_factory.cc index de23cc902..fae0d8018 100644 --- a/table/plain_table_factory.cc +++ b/table/plain_table_factory.cc @@ -52,10 +52,10 @@ std::string PlainTableFactory::GetPrintableTableOptions() const { snprintf(buffer, kBufferSize, " hash_table_ratio: %lf\n", hash_table_ratio_); ret.append(buffer); - snprintf(buffer, kBufferSize, " index_sparseness: %zd\n", + snprintf(buffer, kBufferSize, " index_sparseness: %zu\n", index_sparseness_); ret.append(buffer); - snprintf(buffer, kBufferSize, " huge_page_tlb_size: %zd\n", + snprintf(buffer, kBufferSize, " huge_page_tlb_size: %zu\n", huge_page_tlb_size_); ret.append(buffer); snprintf(buffer, kBufferSize, " encoding_type: %d\n", From e55aea5512dfc2c7bc9595b5d307269f3d002a03 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:27:35 +0200 Subject: [PATCH 17/20] document_db.cc: fix assert Check for lhs and not twice for rhs. Fix for: [utilities/document/document_db.cc:36] -> [utilities/document/document_db.cc:36]: (style) Same expression on both sides of '&&'. Signed-off-by: Danny Al-Gaaf --- utilities/document/document_db.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/document/document_db.cc b/utilities/document/document_db.cc index b9157f274..901e91163 100644 --- a/utilities/document/document_db.cc +++ b/utilities/document/document_db.cc @@ -33,7 +33,7 @@ namespace { // > 0 <=> lhs == rhs // TODO(icanadi) move this to JSONDocument? int DocumentCompare(const JSONDocument& lhs, const JSONDocument& rhs) { - assert(rhs.IsObject() == false && rhs.IsObject() == false && + assert(lhs.IsObject() == false && rhs.IsObject() == false && lhs.type() == rhs.type()); switch (lhs.type()) { From 676ff7b1fbd9c7aaa1b3c9100a14f91d63823d3c Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:31:47 +0200 Subject: [PATCH 18/20] compaction_picker.cc: remove check for >=0 for unsigned Fix for: [db/compaction_picker.cc:923]: (style) Unsigned variable 'start_index' can't be negative so it is unnecessary to test it. Signed-off-by: Danny Al-Gaaf --- db/compaction_picker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/compaction_picker.cc b/db/compaction_picker.cc index eb434eeac..add3556d8 100644 --- a/db/compaction_picker.cc +++ b/db/compaction_picker.cc @@ -920,7 +920,7 @@ Compaction* UniversalCompactionPicker::PickCompactionUniversalSizeAmp( "earliest-file-size %" PRIu64, version->cfd_->GetName().c_str(), candidate_size, earliest_file_size); } - assert(start_index >= 0 && start_index < files.size() - 1); + assert(start_index < files.size() - 1); // Estimate total file size uint64_t estimated_total_size = 0; From 0fd8bbca53fafb3a729b0f6f470c2d024d3e6473 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:45:23 +0200 Subject: [PATCH 19/20] db/db_impl.cc: reduce scope of prefix_initialized Signed-off-by: Danny Al-Gaaf --- db/db_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 3bf60a2d1..1a2b7f7b2 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3064,7 +3064,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact, assert(compact); compact->CleanupBatchBuffer(); compact->CleanupMergedBuffer(); - bool prefix_initialized = false; // Generate file_levels_ for compaction berfore making Iterator compact->compaction->GenerateFileLevels(); @@ -3149,6 +3148,7 @@ Status DBImpl::DoCompactionWork(CompactionState* compact, // 2) send value_buffer to compaction filter and alternate the values; // 3) merge value_buffer with ineligible_value_buffer; // 4) run the modified "compaction" using the old for loop. + bool prefix_initialized = false; shared_ptr backup_input( versions_->MakeInputIterator(compact->compaction)); backup_input->SeekToFirst(); From 8ee75dca2e9ef385e0358aa785cb43becc4f09d2 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 29 Sep 2014 23:55:21 +0200 Subject: [PATCH 20/20] db/memtable.cc: remove unused variable merge_result Signed-off-by: Danny Al-Gaaf --- db/memtable.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/db/memtable.cc b/db/memtable.cc index bdfbc805f..b9b99a684 100644 --- a/db/memtable.cc +++ b/db/memtable.cc @@ -413,7 +413,6 @@ static bool SaveValue(void* arg, const char* entry) { *(s->found_final_value) = true; return false; } - std::string merge_result; // temporary area for merge results later Slice v = GetLengthPrefixedSlice(key_ptr + key_length); *(s->merge_in_progress) = true; merge_context->PushOperand(v);