From fe0d23059d8f3d0ad1141a7ada327e2130768d00 Mon Sep 17 00:00:00 2001 From: Zhongyi Xie Date: Wed, 24 Oct 2018 20:13:06 -0700 Subject: [PATCH] Fix two contrun job failures (#4587) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Currently there are two contrun test failures: * rocksdb-contrun-lite: > tools/db_bench_tool.cc: In function ‘int rocksdb::db_bench_tool(int, char**)’: tools/db_bench_tool.cc:5814:5: error: ‘DumpMallocStats’ is not a member of ‘rocksdb’ rocksdb::DumpMallocStats(&stats_string); ^ make: *** [tools/db_bench_tool.o] Error 1 * rocksdb-contrun-unity: > In file included from unity.cc:44:0: db/range_tombstone_fragmenter.cc: In member function ‘void rocksdb::FragmentedRangeTombstoneIterator::FragmentTombstones(std::unique_ptr >, rocksdb::SequenceNumber)’: db/range_tombstone_fragmenter.cc:90:14: error: reference to ‘ParsedInternalKeyComparator’ is ambiguous auto cmp = ParsedInternalKeyComparator(icmp_); This PR will fix them Pull Request resolved: https://github.com/facebook/rocksdb/pull/4587 Differential Revision: D10846554 Pulled By: miasantreble fbshipit-source-id: 8d3358879e105060197b1379c84aecf51b352b93 --- db/dbformat.h | 12 ++++++++++++ db/range_del_aggregator.cc | 12 ------------ db/range_tombstone_fragmenter.cc | 16 ---------------- tools/db_bench_tool.cc | 8 +++++--- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/db/dbformat.h b/db/dbformat.h index 2b88de732..ffa4695bf 100644 --- a/db/dbformat.h +++ b/db/dbformat.h @@ -674,5 +674,17 @@ int InternalKeyComparator::CompareKeySeq(const Slice& akey, return r; } +struct ParsedInternalKeyComparator { + explicit ParsedInternalKeyComparator(const InternalKeyComparator* c) + : cmp(c) {} + + bool operator()(const ParsedInternalKey& a, + const ParsedInternalKey& b) const { + return cmp->Compare(a, b) < 0; + } + + const InternalKeyComparator* cmp; +}; + } // namespace rocksdb diff --git a/db/range_del_aggregator.cc b/db/range_del_aggregator.cc index 81e1da039..331758558 100644 --- a/db/range_del_aggregator.cc +++ b/db/range_del_aggregator.cc @@ -22,18 +22,6 @@ struct TombstoneStartKeyComparator { const InternalKeyComparator* cmp; }; -struct ParsedInternalKeyComparator { - explicit ParsedInternalKeyComparator(const InternalKeyComparator* c) - : cmp(c) {} - - bool operator()(const ParsedInternalKey& a, - const ParsedInternalKey& b) const { - return cmp->Compare(a, b) < 0; - } - - const InternalKeyComparator* cmp; -}; - // An UncollapsedRangeDelMap is quick to create but slow to answer ShouldDelete // queries. class UncollapsedRangeDelMap : public RangeDelMap { diff --git a/db/range_tombstone_fragmenter.cc b/db/range_tombstone_fragmenter.cc index cc3d26e06..78090d93d 100644 --- a/db/range_tombstone_fragmenter.cc +++ b/db/range_tombstone_fragmenter.cc @@ -17,22 +17,6 @@ namespace rocksdb { -namespace { - -struct ParsedInternalKeyComparator { - explicit ParsedInternalKeyComparator(const InternalKeyComparator* c) - : cmp(c) {} - - bool operator()(const ParsedInternalKey& a, - const ParsedInternalKey& b) const { - return cmp->Compare(a, b) < 0; - } - - const InternalKeyComparator* cmp; -}; - -} // anonymous namespace - FragmentedRangeTombstoneIterator::FragmentedRangeTombstoneIterator( std::unique_ptr unfragmented_tombstones, const InternalKeyComparator& icmp, SequenceNumber snapshot) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index e028f75aa..f2da6580d 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -938,6 +938,9 @@ DEFINE_uint64(max_compaction_bytes, rocksdb::Options().max_compaction_bytes, #ifndef ROCKSDB_LITE DEFINE_bool(readonly, false, "Run read only benchmarks."); + +DEFINE_bool(print_malloc_stats, false, + "Print malloc stats to stdout after benchmarks finish."); #endif // ROCKSDB_LITE DEFINE_bool(disable_auto_compactions, false, "Do not auto trigger compactions"); @@ -1039,9 +1042,6 @@ DEFINE_bool(dump_malloc_stats, true, "Dump malloc stats in LOG "); DEFINE_uint64(stats_dump_period_sec, rocksdb::Options().stats_dump_period_sec, "Gap between printing stats to log in seconds"); -DEFINE_bool(print_malloc_stats, false, - "Print malloc stats to stdout after benchmarks finish."); - enum RepFactory { kSkipList, kPrefixHash, @@ -5809,11 +5809,13 @@ int db_bench_tool(int argc, char** argv) { rocksdb::Benchmark benchmark; benchmark.Run(); +#ifndef ROCKSDB_LITE if (FLAGS_print_malloc_stats) { std::string stats_string; rocksdb::DumpMallocStats(&stats_string); fprintf(stdout, "Malloc stats:\n%s\n", stats_string.c_str()); } +#endif // ROCKSDB_LITE return 0; }