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

refactor: use bytesize::ByteSize for TrieCacheConfig #10412

Merged
merged 3 commits into from
Jan 12, 2024

Conversation

pugachAG
Copy link
Contributor

As suggested in #10409 (comment) to keep it consistent with the rest of StoreConfig.

@pugachAG pugachAG added C-housekeeping Category: Refactoring, cleanups, code quality A-storage Area: storage and databases labels Jan 12, 2024
@pugachAG pugachAG requested a review from wacban January 12, 2024 13:02
@pugachAG pugachAG requested a review from a team as a code owner January 12, 2024 13:02
Copy link

codecov bot commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (38afdd5) 71.91% compared to head (61c5155) 71.92%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10412      +/-   ##
==========================================
+ Coverage   71.91%   71.92%   +0.01%     
==========================================
  Files         719      719              
  Lines      144914   144936      +22     
  Branches   144914   144936      +22     
==========================================
+ Hits       104211   104246      +35     
+ Misses      35932    35909      -23     
- Partials     4771     4781      +10     
Flag Coverage Δ
backward-compatibility 0.08% <0.00%> (-0.01%) ⬇️
db-migration 0.08% <0.00%> (-0.01%) ⬇️
genesis-check 1.26% <75.00%> (-0.01%) ⬇️
integration-tests 36.75% <42.10%> (+0.11%) ⬆️
linux 71.44% <100.00%> (-0.01%) ⬇️
linux-nightly 71.49% <100.00%> (-0.01%) ⬇️
macos 55.19% <100.00%> (+1.48%) ⬆️
pytests 1.48% <75.00%> (-0.01%) ⬇️
sanity-checks 1.27% <75.00%> (-0.01%) ⬇️
unittests 68.14% <100.00%> (-0.01%) ⬇️
upgradability 0.13% <0.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.

Copy link
Collaborator

@Ekleog-NEAR Ekleog-NEAR left a comment

Choose a reason for hiding this comment

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

LGTM, always happy to see stronger types in nearcore 🎉

core/store/src/trie/trie_storage.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@wacban wacban left a comment

Choose a reason for hiding this comment

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

LGTM

Just sanity check - are there any config compatibility issues (as in would this break any existing config.json that some nodes may have deployed)?

@Ekleog-NEAR
Copy link
Collaborator

ByteSize parses integers as though they were a number of bytes, so I don’t see any potential for compatibility issues there :)

pub(crate) const DEFAULT_SHARD_CACHE_TOTAL_SIZE_LIMIT: u64 =
if cfg!(feature = "no_cache") { 1 } else { 50_000_000 };
pub(crate) const DEFAULT_SHARD_CACHE_TOTAL_SIZE_LIMIT: bytesize::ByteSize =
if cfg!(feature = "no_cache") { bytesize::ByteSize::mb(1) } else { bytesize::ByteSize::mb(50) };
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the 1B -> 1MB intentional for the no cache case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, that was a mistake, thanks for catching!

@pugachAG pugachAG added this pull request to the merge queue Jan 12, 2024
Merged via the queue into near:master with commit e9eb116 Jan 12, 2024
20 checks passed
@pugachAG pugachAG deleted the trie-cache-config-types branch January 12, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-storage Area: storage and databases C-housekeeping Category: Refactoring, cleanups, code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants