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

Cache session outcome count #4072

Merged
merged 3 commits into from
Jan 19, 2024
Merged

Conversation

elsirion
Copy link
Contributor

Introduces a DB entry that caches the number of session outcomes in the DB so that we don't have to scan the entire DB every time we need this number.

Fixes #4066

@elsirion
Copy link
Contributor Author

I ran into some trouble with DB migration tests, could you take a look at 487a5c4 in particular please @m1sterc001guy? Is my attempt to fix it correct or am I missing something?

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (9c36777) 58.28% compared to head (edf8d46) 58.29%.

Files Patch % Lines
fedimint-server/src/db.rs 66.66% 9 Missing ⚠️
fedimint-dbtool/src/dump.rs 0.00% 8 Missing ⚠️
fedimint-server/src/consensus/server.rs 53.84% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4072   +/-   ##
=======================================
  Coverage   58.28%   58.29%           
=======================================
  Files         193      193           
  Lines       42580    42605   +25     
=======================================
+ Hits        24819    24836   +17     
- Misses      17761    17769    +8     

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

Otherwise, migration tests won't actually run migrations.
@elsirion elsirion marked this pull request as ready for review January 19, 2024 10:59
@elsirion elsirion requested review from a team as code owners January 19, 2024 10:59
@m1sterc001guy
Copy link
Contributor

I ran into some trouble with DB migration tests, could you take a look at 487a5c4 in particular please @m1sterc001guy? Is my attempt to fix it correct or am I missing something?

This is correct, thanks for pointing that out. It hadn't mattered before since we were just reading from old dbs to catch breaking changes, but now with a migration it is needed.

Copy link
Contributor

@dpc dpc left a comment

Choose a reason for hiding this comment

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

I don't think it's a cache, but LGTM.

@dpc dpc added this pull request to the merge queue Jan 19, 2024
Merged via the queue into fedimint:master with commit 23a54a9 Jan 19, 2024
20 checks passed
@fedimint-backports
Copy link

Backport failed for releases/v0.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin releases/v0.2
git worktree add -d .worktree/backport-4072-to-releases/v0.2 origin/releases/v0.2
cd .worktree/backport-4072-to-releases/v0.2
git switch --create backport-4072-to-releases/v0.2
git cherry-pick -x a29d1ff79feeade7c384088b8c1c8a5b5520f421 62b6df4cef5c804d1fd5e61faee510f4d5b25586 edf8d46813780bf8603867a37cb47fb2d905b140

@github-actions github-actions bot mentioned this pull request Jan 20, 2024
@dpc
Copy link
Contributor

dpc commented Jan 20, 2024

@fedimint-backports Disappointing.

@maan2003 maan2003 mentioned this pull request Jan 22, 2024
@elsirion
Copy link
Contributor Author

I don't think it's a cache

What would you call it? It's redundant/something we could re-build any time, but at considerable cost.

@elsirion elsirion deleted the 2024-01-slow-session-count branch January 22, 2024 14:47
@douglaz
Copy link
Contributor

douglaz commented Jan 22, 2024

I don't think it's a cache

What would you call it? It's redundant/something we could re-build any time, but at considerable cost.

I call it "denormalized data"

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.

ConsensusApi::session_count() is extremely CPU-intensive
6 participants