-
Notifications
You must be signed in to change notification settings - Fork 18
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
SDSTOR-10892 : concurrent mem btree UT #137
Conversation
return s_ptr; | ||
//static boost::fibers::local_fiber <BtreeThreadVariables> *s_ptr{nullptr}; | ||
auto this_id( boost::this_fiber::get_id() ); | ||
static thread_local std::map<fibers::fiber::id, std::unique_ptr<BtreeThreadVariables>> fiber_map; |
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.
Does this assume that fibers are not moved across threads. In that case fiber1 will have entry in multiple threads.
src/tests/test_mem_btree.cpp
Outdated
} | ||
|
||
void random_get() { | ||
static std::uniform_int_distribution< uint32_t > s_rand_range_generator{1, 100}; |
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.
this has to be thread_local or thread safe. as internal state is changed. same in all functions.
key = m_range_scheduler.pick_random_non_existing_keys(nkeys, m_max_range_input); | ||
} | ||
|
||
if (key == -1) { return; } |
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.
assert ?
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.
no assert is needed. It is possible that in this range, there is no available free keys (or after multiple random attempts) . So lets return it.
src/tests/test_mem_btree.cpp
Outdated
} | ||
|
||
private: | ||
bool non_of_them_existed(uint32_t key, uint32_t nkeys) { |
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.
std::none_of ?
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.
same as nit: std::all_of
Codecov ReportPatch coverage:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #137 +/- ##
==========================================
+ Coverage 47.56% 54.77% +7.20%
==========================================
Files 86 87 +1
Lines 7114 7285 +171
Branches 916 947 +31
==========================================
+ Hits 3384 3990 +606
+ Misses 3403 2894 -509
- Partials 327 401 +74
☔ View full report in Codecov by Sentry. |
@@ -37,6 +37,12 @@ typedef std::function< bool(const BtreeKey&, const BtreeKey&, const BtreeValue&, | |||
|
|||
using BtreeNodePtr = boost::intrusive_ptr< BtreeNode >; | |||
|
|||
struct BtreeVisualizeVariables { |
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.
Lets keep this in a separate CL.
if (s_ptr == nullptr) { | ||
static thread_local BtreeThreadVariables inst; | ||
s_ptr = &inst; | ||
#if 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.
remove this ?
@@ -327,11 +327,12 @@ void Btree< K, V >::print_tree(const std::string& file) const { | |||
to_string(m_root_node_info.bnode_id(), buf); | |||
m_btree_lock.unlock_shared(); | |||
|
|||
BT_LOG(INFO, "Pre order traversal of tree:\n<{}>", buf); |
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.
we can log the btree to 2 places stdout/BT_LOG and file. file is mostly just for testing.
@@ -345,6 +346,46 @@ void Btree< K, V >::print_tree_keys() const { | |||
BT_LOG(INFO, "Pre order traversal of tree:\n<{}>", buf); | |||
} | |||
|
|||
template < typename K, typename V > |
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.
Please create a separate CL for the visualization
@@ -46,7 +46,7 @@ chunk_selector_type_t test_common::HSTestHelper::s_ds_chunk_sel_type; | |||
|
|||
SISL_OPTION_GROUP(test_index_btree, | |||
(num_iters, "", "num_iters", "number of iterations for rand ops", | |||
::cxxopts::value< uint32_t >()->default_value("65536"), "number"), | |||
::cxxopts::value< uint32_t >()->default_value("1500"), "number"), |
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.
with 4k , 65k entries should work right ?
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.
correct. considering 4 btree node variations, this is for building purpose to make it fast.
No description provided.