From 6a5071ceb528c2cd2d9b28f47ecdf5151d669985 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Wed, 25 Jan 2023 14:27:02 -0800 Subject: [PATCH] Support PutEntity in trace analyzer (#11127) Summary: Add the most basic support such that trace_analyzer commands no longer fail with ``` Cannot process the write batch in the trace Cannot process the TraceRecord PutEntityCF not implemented Cannot process the trace ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/11127 Reviewed By: cbi42 Differential Revision: D42732319 Pulled By: ajkr fbshipit-source-id: 162d8a31318672a46539b1b042ec25f69b25c4ed --- tools/trace_analyzer_test.cc | 2 +- tools/trace_analyzer_tool.cc | 6 ++++++ tools/trace_analyzer_tool.h | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/trace_analyzer_test.cc b/tools/trace_analyzer_test.cc index d7f9e4da8..7f4035916 100644 --- a/tools/trace_analyzer_test.cc +++ b/tools/trace_analyzer_test.cc @@ -336,7 +336,7 @@ TEST_F(TraceAnalyzerTest, Put) { CheckFileContent(k_whole_prefix, file_path, true); // Check the overall qps - std::vector all_qps = {"0 1 0 0 0 0 0 0 0 1"}; + std::vector all_qps = {"0 1 0 0 0 0 0 0 0 0 1"}; file_path = output_path + "/test-qps_stats.txt"; CheckFileContent(all_qps, file_path, true); diff --git a/tools/trace_analyzer_tool.cc b/tools/trace_analyzer_tool.cc index 5a6d67864..25717b5f0 100644 --- a/tools/trace_analyzer_tool.cc +++ b/tools/trace_analyzer_tool.cc @@ -1582,6 +1582,12 @@ Status TraceAnalyzer::PutCF(uint32_t column_family_id, const Slice& key, column_family_id, key, value.size()); } +Status TraceAnalyzer::PutEntityCF(uint32_t column_family_id, const Slice& key, + const Slice& value) { + return OutputAnalysisResult(TraceOperationType::kPutEntity, write_batch_ts_, + column_family_id, key, value.size()); +} + // Handle the Delete request in the write batch of the trace Status TraceAnalyzer::DeleteCF(uint32_t column_family_id, const Slice& key) { return OutputAnalysisResult(TraceOperationType::kDelete, write_batch_ts_, diff --git a/tools/trace_analyzer_tool.h b/tools/trace_analyzer_tool.h index 4b885b18c..943966d60 100644 --- a/tools/trace_analyzer_tool.h +++ b/tools/trace_analyzer_tool.h @@ -35,7 +35,8 @@ enum TraceOperationType : int { kIteratorSeek = 6, kIteratorSeekForPrev = 7, kMultiGet = 8, - kTaTypeNum = 9 + kPutEntity = 9, + kTaTypeNum = 10 }; struct TraceUnit { @@ -201,6 +202,10 @@ class TraceAnalyzer : private TraceRecord::Handler, Status PutCF(uint32_t column_family_id, const Slice& key, const Slice& value) override; + using WriteBatch::Handler::PutEntityCF; + Status PutEntityCF(uint32_t column_family_id, const Slice& key, + const Slice& value) override; + using WriteBatch::Handler::DeleteCF; Status DeleteCF(uint32_t column_family_id, const Slice& key) override; -- GitLab