Skip to content
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

Fix rounding function for max entries #1381

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Fix rounding function for max entries #1381

merged 2 commits into from
Nov 20, 2024

Conversation

rafaelroquetto
Copy link
Contributor

Do not round to 0, round to at least N

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.09%. Comparing base (99e7f0f) to head (3dfa1e5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1381   +/-   ##
=======================================
  Coverage   81.09%   81.09%           
=======================================
  Files         147      147           
  Lines       14745    14751    +6     
=======================================
+ Hits        11957    11962    +5     
- Misses       2205     2206    +1     
  Partials      583      583           
Flag Coverage Δ
integration-test 58.71% <50.00%> (-0.04%) ⬇️
k8s-integration-test 59.84% <50.00%> (-0.06%) ⬇️
oats-test 34.18% <50.00%> (+0.02%) ⬆️
unittests 51.95% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Contributor

@marctc marctc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoud we add unit test for this?

@rafaelroquetto
Copy link
Contributor Author

@marctc good idea, will do

Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! But it made me think, shouldn't we always round up? Rounding down can lead to unexpected behaviour.

@rafaelroquetto
Copy link
Contributor Author

@grcevski you are right - but there are also issues with rounding up, namely excessive memory consumption - for instance, if the page size is 16384 and we have the hypothetical value of 17000, it would round up to 32768, which would be super wasteful - so that's the trade-off.
I believe the max entries of our maps will never come any closer to any page size anyway, so in practice it will always be rounded up to the page size - but in case it's slightly over, it will just be adjusted to the nearest multiple of the page size, rather than doubling it (and it will be a big number anyway - if that's an issue, then we have other issues I guess).

I will merge the PR but happy to raise a follow up if it turns out rounding up is still the best approach.

@rafaelroquetto rafaelroquetto merged commit 6f8e493 into main Nov 20, 2024
13 checks passed
@rafaelroquetto rafaelroquetto deleted the page_size2 branch November 20, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants