-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add bitmap control for perf context #237
Conversation
design spec in on: https://docs.google.com/document/d/1JYmWMIZwYV0AZW6rNv_oFVZLBCAkxLLYslt39eEZstM/edit?usp=sharing Signed-off-by: lemonhx <[email protected]>
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 overall
monitoring/perf_flag_test.cc
Outdated
SetPerfLevel(PerfLevel::kDisable); | ||
EnablePerfFlag(flag_user_key_comparison_count); | ||
}, | ||
{ ASSERT_GT(get_perf_context()->user_key_comparison_count, 0); }); |
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.
Perf context is stored locally so that it may contain data from previous tests. I would suggest you to assert the delta value.
/run-tests |
@LemonHX build fail. along with CMakeList.txt, you also need to add the new files and new tests to src.mk and https://github.com/tikv/rocksdb/blob/6.4.tikv/Makefile#L420 |
/run-tests |
done |
/run-tests |
1 similar comment
/run-tests |
The encryption_env test and Mac test in CI are broken. We can ignore them for now. |
so could we merge it? |
@yiwu-arbug Are we running clang-format in CI right now? I wonder how these styling issues go unalerted. |
@LemonHX Could you run this line in your repo to format this PR manually? I'm not sure if there's any issues I haven't sighted.
And a few commit signoffs need fixing. |
fix indentation error in `c.cc` adding comment on `FLAG_END` explain what does `& 0b111` does fix a huge mistake in `CheckPerfFlag` and writing the edge case tests for `perf_flag` Signed-off-by: lemonhx <[email protected]>
add test into `Makefile` and removed unused variable. fix indentation error in `CMakeLists` Signed-off-by: lemonhx <[email protected]>
Co-authored-by: Xinye Tao <[email protected]> Signed-off-by: lemonhx <[email protected]>
Signed-off-by: tabokie <[email protected]>
Signed-off-by: tabokie <[email protected]>
Signed-off-by: tabokie <[email protected]>
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.
I've manually resolved all the review comments. LGTM
include/rocksdb/perf_flag.h
Outdated
|
||
#define FLAGS_LEN \ | ||
(((uint64_t)FLAG_END & (uint64_t)0b111) == 0 \ | ||
? ((uint64_t)FLAG_END >> (uint64_t)0b11) \ |
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.
? ((uint64_t)FLAG_END >> (uint64_t)0b11) \ | |
? ((uint64_t)FLAG_END >> (uint64_t)3) \ |
include/rocksdb/perf_flag.h
Outdated
#define FLAGS_LEN \ | ||
(((uint64_t)FLAG_END & (uint64_t)0b111) == 0 \ | ||
? ((uint64_t)FLAG_END >> (uint64_t)0b11) \ | ||
: ((uint64_t)FLAG_END >> (uint64_t)0b11) + (uint64_t)1) |
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.
: ((uint64_t)FLAG_END >> (uint64_t)0b11) + (uint64_t)1) | |
: ((uint64_t)FLAG_END >> (uint64_t)3) + (uint64_t)1) |
Signed-off-by: tabokie <[email protected]>
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
This PR changes some bits of #237. Considering our use cases in TiKV, _although not really necessary_, we frequently set perf levels around RocksDB operations. So, if we switch to perf flags, it requires us to set perf flags efficiently. And we have quite a few flags to set, setting flags one by one in #237 is not that efficient. All flags can be saved in two words. So, we **can** achieve similar efficiency by setting all flags all at once. And meanwhile, we can flexibly specify which metrics we care about at runtime. This PR also changes to use `std::bitset` and a named enum instead of handmade int array and anonymous enum. Hopefully they will make the code cleaner. See tikv/rust-rocksdb#682 for the companion Rust wrapper Signed-off-by: Yilin Chen <[email protected]>
* `PerfFlag` implementation aside the `PerfLevel` design spec in on: https://docs.google.com/document/d/1JYmWMIZwYV0AZW6rNv_oFVZLBCAkxLLYslt39eEZstM/edit?usp=sharing Signed-off-by: lemonhx <[email protected]> Co-authored-by: Xinye Tao <[email protected]> Signed-off-by: tabokie <[email protected]>
This PR changes some bits of tikv#237. Considering our use cases in TiKV, _although not really necessary_, we frequently set perf levels around RocksDB operations. So, if we switch to perf flags, it requires us to set perf flags efficiently. And we have quite a few flags to set, setting flags one by one in tikv#237 is not that efficient. All flags can be saved in two words. So, we **can** achieve similar efficiency by setting all flags all at once. And meanwhile, we can flexibly specify which metrics we care about at runtime. This PR also changes to use `std::bitset` and a named enum instead of handmade int array and anonymous enum. Hopefully they will make the code cleaner. See tikv/rust-rocksdb#682 for the companion Rust wrapper Signed-off-by: Yilin Chen <[email protected]> Signed-off-by: tabokie <[email protected]>
* `PerfFlag` implementation aside the `PerfLevel` design spec in on: https://docs.google.com/document/d/1JYmWMIZwYV0AZW6rNv_oFVZLBCAkxLLYslt39eEZstM/edit?usp=sharing Signed-off-by: lemonhx <[email protected]> Co-authored-by: Xinye Tao <[email protected]> Signed-off-by: tabokie <[email protected]>
This PR changes some bits of #237. Considering our use cases in TiKV, _although not really necessary_, we frequently set perf levels around RocksDB operations. So, if we switch to perf flags, it requires us to set perf flags efficiently. And we have quite a few flags to set, setting flags one by one in #237 is not that efficient. All flags can be saved in two words. So, we **can** achieve similar efficiency by setting all flags all at once. And meanwhile, we can flexibly specify which metrics we care about at runtime. This PR also changes to use `std::bitset` and a named enum instead of handmade int array and anonymous enum. Hopefully they will make the code cleaner. See tikv/rust-rocksdb#682 for the companion Rust wrapper Signed-off-by: Yilin Chen <[email protected]> Signed-off-by: tabokie <[email protected]>
* `PerfFlag` implementation aside the `PerfLevel` design spec in on: https://docs.google.com/document/d/1JYmWMIZwYV0AZW6rNv_oFVZLBCAkxLLYslt39eEZstM/edit?usp=sharing Signed-off-by: lemonhx <[email protected]> Co-authored-by: Xinye Tao <[email protected]> Signed-off-by: tabokie <[email protected]>
This PR changes some bits of tikv#237. Considering our use cases in TiKV, _although not really necessary_, we frequently set perf levels around RocksDB operations. So, if we switch to perf flags, it requires us to set perf flags efficiently. And we have quite a few flags to set, setting flags one by one in tikv#237 is not that efficient. All flags can be saved in two words. So, we **can** achieve similar efficiency by setting all flags all at once. And meanwhile, we can flexibly specify which metrics we care about at runtime. This PR also changes to use `std::bitset` and a named enum instead of handmade int array and anonymous enum. Hopefully they will make the code cleaner. See tikv/rust-rocksdb#682 for the companion Rust wrapper Signed-off-by: Yilin Chen <[email protected]> Signed-off-by: tabokie <[email protected]>
Design document
related issue No.543 in rust-rocksdb