From 50d696981664d20870890da634d4c2102f14b8c6 Mon Sep 17 00:00:00 2001 From: sdong Date: Wed, 24 Jun 2020 13:39:26 -0700 Subject: [PATCH] Fix unity build broken by #7007 (#7024) Summary: https://github.com/facebook/rocksdb/pull/7007 broken the unity build. Fix it by moving the const inside the function Pull Request resolved: https://github.com/facebook/rocksdb/pull/7024 Test Plan: make unity and see it to build. Reviewed By: zhichao-cao Differential Revision: D22212028 fbshipit-source-id: 5daff7383b691808164d4745ab543238502d946b --- trace_replay/block_cache_tracer.cc | 4 ++-- trace_replay/io_tracer.cc | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/trace_replay/block_cache_tracer.cc b/trace_replay/block_cache_tracer.cc index 9a96f1bac..350fc3d5c 100644 --- a/trace_replay/block_cache_tracer.cc +++ b/trace_replay/block_cache_tracer.cc @@ -19,8 +19,6 @@ namespace ROCKSDB_NAMESPACE { namespace { -const unsigned int kCharSize = 1; - bool ShouldTrace(const Slice& block_key, const TraceOptions& trace_options) { if (trace_options.sampling_frequency == 0 || trace_options.sampling_frequency == 1) { @@ -217,6 +215,8 @@ Status BlockCacheTraceReader::ReadAccess(BlockCacheTraceRecord* record) { record->block_type = trace.type; Slice enc_slice = Slice(trace.payload); + const unsigned int kCharSize = 1; + Slice block_key; if (!GetLengthPrefixedSlice(&enc_slice, &block_key)) { return Status::Incomplete( diff --git a/trace_replay/io_tracer.cc b/trace_replay/io_tracer.cc index c9787ea86..d9f701587 100644 --- a/trace_replay/io_tracer.cc +++ b/trace_replay/io_tracer.cc @@ -17,11 +17,6 @@ #include "util/string_util.h" namespace ROCKSDB_NAMESPACE { - -namespace { -const unsigned int kCharSize = 1; -} // namespace - IOTraceWriter::IOTraceWriter(Env* env, const TraceOptions& trace_options, std::unique_ptr&& trace_writer) : env_(env), @@ -143,6 +138,7 @@ Status IOTraceReader::ReadIOOp(IOTraceRecord* record) { record->file_name = file_name.ToString(); // TODO: Read below options based on file_operation. record->len = static_cast(enc_slice[0]); + const unsigned int kCharSize = 1; enc_slice.remove_prefix(kCharSize); if (enc_slice.empty()) { return Status::Incomplete(