From 1cf17ba53bc20b0c82f24a5212d21c1d114ddc0c Mon Sep 17 00:00:00 2001 From: Zhongyi Xie Date: Thu, 30 Aug 2018 18:28:47 -0700 Subject: [PATCH] Rename DecodeCFAndKey to resolve naming conflict in unity test (#4323) Summary: Currently unity-test is failing because both trace_replay.cc and trace_analyzer_tool.cc defined `DecodeCFAndKey` under anonymous namespace. It is supposed to be fine except unity test will dump all source files together and now we have a conflict. Another issue with trace_analyzer_tool.cc is that it is using some utility functions from ldb_cmd which is not included in Makefile for unity_test, I chose to update TESTHARNESS to include LIBOBJECTS. Feel free to comment if there is a less intrusive way to solve this. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4323 Differential Revision: D9599170 Pulled By: miasantreble fbshipit-source-id: 38765b11f8e7de92b43c63bdcf43ea914abdc029 --- Makefile | 4 +++- tools/trace_analyzer_tool.cc | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 14b06380a..7e37e6dbb 100644 --- a/Makefile +++ b/Makefile @@ -1002,8 +1002,10 @@ unity.a: unity.o $(AM_V_AR)rm -f $@ $(AM_V_at)$(AR) $(ARFLAGS) $@ unity.o + +TOOLLIBOBJECTS = $(TOOL_LIB_SOURCES:.cc=.o) # try compiling db_test with unity -unity_test: db/db_test.o db/db_test_util.o $(TESTHARNESS) unity.a +unity_test: db/db_test.o db/db_test_util.o $(TESTHARNESS) $(TOOLLIBOBJECTS) unity.a $(AM_LINK) ./unity_test diff --git a/tools/trace_analyzer_tool.cc b/tools/trace_analyzer_tool.cc index 943610800..7915322f0 100644 --- a/tools/trace_analyzer_tool.cc +++ b/tools/trace_analyzer_tool.cc @@ -185,7 +185,7 @@ uint64_t MultiplyCheckOverflow(uint64_t op1, uint64_t op2) { return (op1 * op2); } -void DecodeCFAndKey(std::string& buffer, uint32_t* cf_id, Slice* key) { +void DecodeCFAndKeyFromString(std::string& buffer, uint32_t* cf_id, Slice* key) { Slice buf(buffer); GetFixed32(&buf, cf_id); GetLengthPrefixedSlice(&buf, key); @@ -459,7 +459,7 @@ Status TraceAnalyzer::StartProcessing() { } else if (trace.type == kTraceGet) { uint32_t cf_id = 0; Slice key; - DecodeCFAndKey(trace.payload, &cf_id, &key); + DecodeCFAndKeyFromString(trace.payload, &cf_id, &key); total_gets_++; s = HandleGet(cf_id, key.ToString(), trace.ts, 1); @@ -471,7 +471,7 @@ Status TraceAnalyzer::StartProcessing() { trace.type == kTraceIteratorSeekForPrev) { uint32_t cf_id = 0; Slice key; - DecodeCFAndKey(trace.payload, &cf_id, &key); + DecodeCFAndKeyFromString(trace.payload, &cf_id, &key); s = HandleIter(cf_id, key.ToString(), trace.ts, trace.type); if (!s.ok()) { fprintf(stderr, "Cannot process the iterator in the trace\n");