diff --git a/tools/block_cache_trace_analyzer.cc b/tools/block_cache_trace_analyzer.cc index 0ef4b55e4..3fd93a023 100644 --- a/tools/block_cache_trace_analyzer.cc +++ b/tools/block_cache_trace_analyzer.cc @@ -442,7 +442,7 @@ void BlockCacheTraceAnalyzer::PrintStatsSummary() const { caller_bt_num_access_map[caller][type] += num_accesses; caller_level_num_access_map[caller][level] += num_accesses; // Column Family stats. - cf_num_accesses++; + cf_num_accesses += num_accesses; cf_caller_num_accesses_map[caller] += num_accesses; cf_caller_level_num_accesses_map[caller][level] += num_accesses; cf_caller_file_num_accesses_map[caller][fd] += num_accesses; diff --git a/trace_replay/block_cache_tracer.cc b/trace_replay/block_cache_tracer.cc index f733bc900..a0f0676ee 100644 --- a/trace_replay/block_cache_tracer.cc +++ b/trace_replay/block_cache_tracer.cc @@ -16,15 +16,14 @@ namespace rocksdb { namespace { const unsigned int kCharSize = 1; -bool ShouldTrace(const BlockCacheTraceRecord& record, - const TraceOptions& trace_options) { +bool ShouldTrace(const Slice& block_key, const TraceOptions& trace_options) { if (trace_options.sampling_frequency == 0 || trace_options.sampling_frequency == 1) { return true; } // We use spatial downsampling so that we have a complete access history for a // block. - const uint64_t hash = GetSliceNPHash64(Slice(record.block_key)); + const uint64_t hash = GetSliceNPHash64(block_key); return hash % trace_options.sampling_frequency == 0; } } // namespace @@ -255,7 +254,7 @@ Status BlockCacheTracer::WriteBlockAccess(const BlockCacheTraceRecord& record, const Slice& block_key, const Slice& cf_name, const Slice& referenced_key) { - if (!writer_.load() || !ShouldTrace(record, trace_options_)) { + if (!writer_.load() || !ShouldTrace(block_key, trace_options_)) { return Status::OK(); } InstrumentedMutexLock lock_guard(&trace_writer_mutex_);