-
Notifications
You must be signed in to change notification settings - Fork 57
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
(#530) Add test cases to exercise print methods for mini-allocator metadata pages and for trunk verbose logging. #531
Conversation
✅ Deploy Preview for splinterdb canceled.
|
uint64 meta_page_no) | ||
{ | ||
return root_addr + (meta_page_no + 1) * btree_page_size(cfg); | ||
} |
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.
Externalized in .h
file so this can be called from unit test case in btree_stress_test.c:test_btree_print_diags()
.
@@ -337,7 +337,7 @@ static uint64 | |||
mini_num_entries(page_handle *meta_page) | |||
{ | |||
mini_meta_hdr *hdr = (mini_meta_hdr *)meta_page->data; | |||
return hdr->num_entries; | |||
return (uint64)hdr->num_entries; |
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.
Shouldn't really matter but just conforming to return type declared for this fn's definition.
@@ -105,6 +105,19 @@ static const int64 latency_histo_buckets[LATENCYHISTO_SIZE] = { | |||
* If verbose_logging_enabled is enabled in trunk_config, these functions print | |||
* to cfg->log_handle. | |||
*/ | |||
void | |||
trunk_enable_verbose_logging(trunk_handle *spl, platform_log_handle *log_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.
Externalized so this can be called directly from unit-test which is not required to go through --cmd-line-args
parsing.
} \ | ||
} while (0) | ||
|
||
#define trunk_default_log_if_enabled(spl, message, ...) \ | ||
do { \ | ||
if (trunk_verbose_logging_enabled(spl)) { \ | ||
platform_default_log(message, __VA_ARGS__); \ | ||
platform_default_log( \ | ||
"trunk_log():%d " message, __LINE__, __VA_ARGS__); \ |
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.
Here, and on L161 above, print the line # where this trace message is generated from, which helps quickly spotting the code which got executed.
params[i].start = i * (nkvs / nthreads); | ||
params[i].end = i < nthreads - 1 ? (i + 1) * (nkvs / nthreads) : nkvs; | ||
} | ||
load_thread_params(params, |
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.
Modularized this out so it can be used in the btree_print_diags()
test-case, which also has to do the same sort of thing to insert a bunch of data.
// Exercise print method to verify that it basically continues to work. | ||
CTEST_LOG_INFO("\n**** btree_print_tree() on BTree root=%lu****\n", | ||
packed_root_addr); |
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 is an existing invocation of a BTree-print method, which has been working fine (previously, too).
meta_page_addr); | ||
|
||
// Exercise print method of mini-allocator's keyed meta-page | ||
mini_keyed_print( |
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 is a new invocation of this print method to print BTree metadata page contents.
This invocation seems to work right, too, and prints what seem like reasonable content:
**** mini_keyed_print() BTree root=1326710784, meta page addr=1326714880 ****
---------------------------------------------------------------------
| Mini Keyed Allocator -- meta_head: 1326714880 |
---------------------------------------------------------------------
| meta addr: 1326714880 (2) |
---------------------------------------------------------------------
| idx | batch | extent_addr | start_key | rc |
---------------------------------------------------------------------
| 0 | 0 | 1326841856 | 0x00000d093a9a1700 | 2 |
| 1 | 0 | 1327890432 | 0x000742d1b6583900 | 2 |
| 2 | 1 | 1326972928 | 0x00000d093a9a1700 | 2 |
| 3 | 0 | 1328021504 | 0x00137c3e4b314000 | 2 |
| 4 | 0 | 1328283648 | 0x001df84b01da2a00 | 2 |
| 5 | 0 | 1328414720 | 0x0026020907020200 | 2 |
| 6 | 0 | 1328545792 | 0x0031fa2efde54b00 | 2 |
| 7 | 0 | 1328676864 | 0x0039713e18992a00 | 2 |
| 8 | 0 | 1328807936 | 0x0044cc7bbd592300 | 2 |
| 9 | 0 | 1328939008 | 0x005006e951322a00 | 2 |
[...]
and so on.
// Exercise print method to verify that it basically continues to work. | ||
CTEST_LOG_INFO("\n**** btree_print_tree() on BTree root=%lu****\n", | ||
packed_root_addr); | ||
btree_print_tree(Platform_default_log_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.
Old code relocated from existing test_random_inserts_concurrent
test case to newly refactored test_btree_print_diags
test case.
This commit does some minor cleanup of the mini-allocator module. Some interfaces are slightly changed to streamline init / deinit interfaces. A new unit-test is added to exercise core interfaces of this page allocation system, and to exercise / test the print methods for keyed and unkeyed page allocation schemes. Extend print methods to also print page_addr and extent_addr as page_num and extent_num, where applicable.
ec129c9
to
f63bb07
Compare
platform_log(log_handle, | ||
"\nFilter Metadata page starting from meta_head=%lu\n{\n", | ||
meta_head); | ||
mini_unkeyed_print(spl->cc, meta_head, PAGE_TYPE_FILTER); |
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.
Here is a sample output from this call, for a routing filter off of trunk's root node:
Filter Metadata page starting from meta_head=6200360960
{
---------------------------------------------
| Mini Allocator -- meta_head=6200360960 (pgnum=1513760)
|-------------------------------------------|
{
|-------------------------------------------|
| meta addr=6200360960 (pgnum=1513760), num_entries=4
| next_meta_addr=0 (pgnum=0), pos=52
|-------------------------------------------|
| idx | extent_addr | extent_num |
|-------------------------------------------|
| 0 | 6200492032 | 47306 |
| 1 | 6200623104 | 47307 |
| 2 | 6200754176 | 47308 |
| 3 | 6200885248 | 47309 |
|-------------------------------------------|
}
Found 1 meta-data pages tracking 4 extents.
}
* generated by trunk_default_log_if_enabled(). | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
CTEST2(splinter, test_splinter_verbose_print_diags) |
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.
Added new test case to exercise the calls to trunk_default_log_if_enabled()
at different code points, which prints intermediate state of trunk trees while large insertions, and other activities (like compaction etc.) are going on.
f63bb07
to
eb54892
Compare
…tapages This commit adds new print function to drive the functions for printing keyed / unkeyed metadata pages of the mini-allocator. Existing test cases are enhanced as follows to eventually exercise these print methods. - Add bunch of print functions in trunk.c to find out routing filter metadata pages and to invoke underlying print methods on such pages. Print pivot key and other filter-related data. - Extend splinter_test:test_splinter_print_diags() to exercise the print function that will walk through routing filter metadata pages for one pivot key off of the trunk's root node and eventually callss mini_unkeyed_print(). - Add new test_splinter_verbose_print_diags test case to exercise the verbose print logging in trunk.c (for a small data set). - Modularize code in btree_stress_test.c to carve out code that is used to build new unit-test case, test_btree_print_diags(). First, this invokes btree_print_tree(), to see outputs of packed BTree node. Then, invokes mini_keyed_print(), to print keyed mini-allocator's metadata pages.
eb54892
to
c7f0422
Compare
Draft PR. This dev work was surfaced as 2-part PRs which were internally discussed. There was no interest in absorbing this work to Abandoned. |
This commit adds new print function to drive the functions for printing keyed / unkeyed metadata pages of the mini-allocator. Existing test cases are enhanced as follows to eventually exercise these print methods.
Extend
splinter_test:test_splinter_print_diags()
to print just one routing-filter page hanging off trunk's root node. New functiontrunk_print_root_nodes_filter_metapages()
will exercise the print function that will walk through routing filter metadata pages for one pivot key and eventually callsmini_unkeyed_print()
.Modularize code in
btree_stress_test.c
to carve out code that is used to build new unit-test case,test_btree_print_diags()
. First, this invokesbtree_print_tree()
, to see outputs of packed BTree node. Then, invokesmini_keyed_print()
, to print keyed mini-allocator's metadata pages.Add bunch of print functions in
trunk.c
to find out routing filter metadata pages and to invoke underlying print methods on such pages.NOTE: This is a draft PR to discuss the changes with Alex & Rob.
[Updated 2.1.2023]: Fixed a bug. Much of the driving functions seem to work ok. The print outputs from updated test cases for keyed and unkeyed mini-allocator's metadata pages for "real-data" (generated by inserting lots of rows into trunk or BTree) seem to work fine.