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

Split roundstate saving in two #2046

Merged
merged 2 commits into from
Mar 22, 2023
Merged

Split roundstate saving in two #2046

merged 2 commits into from
Mar 22, 2023

Conversation

hbandura
Copy link
Contributor

Split the roundstate saving, allowing consensus message processing to be a bit faster.

@github-actions
Copy link

github-actions bot commented Mar 15, 2023

Coverage from tests in ./e2e_test/... for ./consensus/istanbul/... at commit bffb07d

coverage: 51.0% of statements across all listed packages
coverage:  63.2% of statements in consensus/istanbul
coverage:  42.7% of statements in consensus/istanbul/announce
coverage:  56.0% of statements in consensus/istanbul/backend
coverage:   0.0% of statements in consensus/istanbul/backend/backendtest
coverage:  24.3% of statements in consensus/istanbul/backend/internal/replica
coverage:  66.0% of statements in consensus/istanbul/core
coverage:  50.0% of statements in consensus/istanbul/db
coverage:   0.0% of statements in consensus/istanbul/proxy
coverage:  64.4% of statements in consensus/istanbul/uptime
coverage:  51.8% of statements in consensus/istanbul/validator
coverage:  79.2% of statements in consensus/istanbul/validator/random

@github-actions
Copy link

github-actions bot commented Mar 15, 2023

5775 passed, 46 skipped

Copy link
Contributor

@mcortesi mcortesi left a comment

Choose a reason for hiding this comment

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

This PR is missing transition logic from old db format to new. I mean if we run this on a old client it will fail.

Still for testing purposes it's ok

@@ -40,6 +41,7 @@ const (
dbVersionKey = "version" // Version of the database to flush if changes
lastViewKey = "lastView" // Last View that we know of
rsKey = "rs" // Database Key Pefix for RoundState
rcvdKey = "rcvd" // Database Key Prefix for rcvd messages from the RoundState (split saving)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not have differente keys for prepares, commits and parent commits?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe they shouldn't have an outstanding size, though I agree that further splitting is better. I'll check how the code looks with it.

@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Patch coverage: 61.90% and project coverage change: +0.01 🎉

Comparison is base (244cad0) 54.20% compared to head (5b297b3) 54.22%.

❗ Current head 5b297b3 differs from pull request most recent head bb16fb8. Consider uploading reports for the commit bb16fb8 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2046      +/-   ##
==========================================
+ Coverage   54.20%   54.22%   +0.01%     
==========================================
  Files         692      692              
  Lines      115463   115618     +155     
==========================================
+ Hits        62585    62691     +106     
- Misses      49050    49082      +32     
- Partials     3828     3845      +17     
Impacted Files Coverage Δ
cmd/utils/flags.go 2.56% <0.00%> (-0.02%) ⬇️
consensus/istanbul/core/roundstate_db.go 58.64% <60.68%> (+0.17%) ⬆️
...nsensus/istanbul/core/roundstate_save_decorator.go 90.90% <62.50%> (-4.18%) ⬇️
consensus/istanbul/core/message_set.go 84.67% <73.68%> (+2.17%) ⬆️
consensus/istanbul/core/roundstate.go 84.40% <100.00%> (-0.03%) ⬇️
core/genesis.go 65.58% <100.00%> (+0.16%) ⬆️

... and 25 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@gastonponti gastonponti left a comment

Choose a reason for hiding this comment

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

Other than the log, and the nit in the test, LGTM

defer ms.messagesMu.Unlock()
var added = 0
for _, msg := range msgs {
err := ms.checkValidToAdd(msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we log the invalid messages or the possible overrides?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, since it's actually expected that there will be some overrides on a load

view := newView(2, 1)
rs := newRoundState(view, valSet, valSet.GetByIndex(0))
rs.AddPrepare(mockViewMsg(view, istanbul.MsgPrepare, valSet.GetByIndex(0).Address()))
rs.AddCommit(mockViewMsg(view, istanbul.MsgPrepare, valSet.GetByIndex(0).Address()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be a istanbul.MsgCommit? (same with the next one)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, missed that

@hbandura hbandura enabled auto-merge (squash) March 21, 2023 09:23
@hbandura hbandura merged commit bffb07d into master Mar 22, 2023
@hbandura hbandura deleted the hbandura/split_rs_db branch March 22, 2023 10:20
palango pushed a commit that referenced this pull request Apr 13, 2023
* Split roundstate saving in two: prepares/commit/parentCommit messages on one side.
@palango palango mentioned this pull request Apr 13, 2023
gastonponti pushed a commit that referenced this pull request Apr 17, 2023
* Split roundstate saving in two: prepares/commit/parentCommit messages on one side.
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