-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify TraceAnalyzer
#8697
Simplify TraceAnalyzer
#8697
Conversation
if (!ta_[TraceOperationType::kGet].enabled) { | ||
return Status::OK(); | ||
} | ||
value_size = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhichao-cao Why change value size to 10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Get trace record, we do not collect the value. So, we do not have the "value" part. In order to simplify the later on calculation, we just give a fixed value. Maybe it would be better to add a comments here to make it more clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more question, why we don't do the same thing for other key only operations (seeks, deletes, etc.)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obviously, we forgot to do the same thing for other non-value recorded operations........
tools/trace_analyzer_tool.h
Outdated
class TraceAnalysisResult : public TraceRecordResult { | ||
public: | ||
// All operations must have the same timestamp and trace type, e.g, MultiGet. | ||
TraceAnalysisResult(TraceOperationType op_type, std::vector<uint32_t> cf_ids, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if in the future, we wan to get some special results from different types? E.g., for iterator, we my need to get the lower and upper bound? So, is a general TraceAnalysisResult enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A general TraceAnalysisResult
may not be enough for all potential special requirements, but at least now it's better to have individual functions with mostly the same code for each operation type.
As for iterator's lower/upper bound, they are used when creating an iterator. I guess later we may need to have some iterator creation trace type, then, the 2 bounds can be handled there.
tools/trace_analyzer_tool.cc
Outdated
return write_result_->Accept(this); | ||
} | ||
|
||
Status TraceAnalyzer::Handle(const TraceAnalysisResult& result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need some comments here to explain what is the job of this "Handle".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
It is used to handle the generic analysis result for outputting purpose. If we don't use TraceAnalysisResult
, we can probably replace it with a single function that does the same job (actually this should be better).
TraceAnalyzer
to use TraceRecordResult
TraceAnalyzer
@@ -169,6 +168,8 @@ DEFINE_double(sample_ratio, 1.0, | |||
|
|||
namespace ROCKSDB_NAMESPACE { | |||
|
|||
const size_t kShadowValueSize = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add comment to explain why we need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a brief description in the header file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the code change, which makes it more clear and simplier.
@autopear has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@autopear has updated the pull request. You must reimport the pull request before landing. |
@autopear has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Handler functions now use a common output function to output to stdout/files. Pull Request resolved: facebook/rocksdb#8697 Test Plan: `trace_analyzer_test` can pass. Reviewed By: zhichao-cao Differential Revision: D30527696 Pulled By: autopear fbshipit-source-id: c626cf4d53a39665a9c4bcf0cb019c448434abe4
Handler functions now use a common output function to output to stdout/files.
Test:
trace_analyzer_test
can pass.