Skip to content

Cleanup of mini_allocator.c . Add unit-tests to exercise this module. #536

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

Closed
wants to merge 14 commits into from

Conversation

gapisback
Copy link
Collaborator

@gapisback gapisback commented Jan 27, 2023

This is a draft PR built on top of PR #531. Code cleanup and unit-tests added to allocator.c and mini_allocator.c

  • Some smaller changes added to allocator.h and allocator.c, which should be peeled off to its own PR.

  • Other cleanup / code consolidation done to mini_allocator.c, along with unit-tests to exercise these interfaces.

Start a draft PR to see how the rest of the tests fare under CI.

…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.

- Extend splinter_test:test_splinter_print_diags() to exercise the print
  function that will walk through routing filter metadata pages for one
  pivot key and eventually calls mini_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
  invokes btree_print_tree(), to see outputs of packed BTree node.
  Then, invokes mini_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.
This commit refactors and does some minor cleanup of code in btree.c,
mini_allocator.c and related files. Some page / extent number / offset
boolean and conversion macros are added, along with unit-tests.
No significant change in code-logic is being introduced with this fix.
Add mini_deinit() to be used on the way out to dismantle a mini-allocator
Add checks for num_extents used in test case.

New test case sees to work ok, but other tests are failing due to
changes done in trunk.c . Needs further investigation.
Add test-case to exercise mini_unkeyed_print().
Minor changes to print outputs from that function.
- In splinter_test, call to trunk_print_root_nodes_filter_metapages()
  is running into a seg-fault. This needs to be resolved under open
  issue #530. For now, comment out this call so that the rest of the
  test runs fine.

- Minor comment updates in mini_allocator.c
- Minor renaming of test code in mini_allocator_test.c

- Full run of slow test.sh passes on Nimbus-VM. Test on CI now.
@netlify
Copy link

netlify bot commented Jan 27, 2023

Deploy Preview for splinterdb canceled.

Name Link
🔨 Latest commit a2f4003
🔍 Latest deploy log https://app.netlify.com/sites/splinterdb/deploys/63d41807be7eff000982425f

@gapisback
Copy link
Collaborator Author

Draft PR to shake-out some coding ideas / directions. Nothing more to be pursued.

@gapisback gapisback closed this Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants