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

[to discuss] exec blocks without ObjectDb: Mutation over TxDb #947

Merged
merged 7 commits into from
Aug 24, 2020

Conversation

AskAlexSharov
Copy link
Collaborator

  • Usage of TxDb means don't open read transaction every time you wanna read something from db.
  • On fast disk it speeding genesis sync 21hour -> 17hours
  • But it a bit increases complexity of stage_exec - now there is db.Begin, then tx.NewBatch, then both of them need periodical commit
  • I need your advise - maybe we can simplify code somehow?

@AlexeyAkhunov
Copy link
Contributor

I don't see it as a big increase in complexity at all. Will test the full sync with it myself soon

@@ -132,6 +147,9 @@ func SpawnExecuteBlocksStage(s *StageState, stateDB ethdb.Database, chainConfig
if _, err := batch.Commit(); err != nil {
return fmt.Errorf("sync Execute: failed to write batch commit: %v", err)
}
if _, err = tx.Commit(); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what will happen when we Commit and the defer calls Rollback?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Commit sets internal transaction object to nil, then rollback do something only if that object is not nil. So, rollback after commit must not do anything. Same for double-rollback.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

With Tx need to be more strict than with mutation: if tx not closed well - it can cause deadlock or leak.

@AlexeyAkhunov AlexeyAkhunov merged commit 43a4e34 into master Aug 24, 2020
@AlexeyAkhunov AlexeyAkhunov deleted the sub_tx4 branch February 3, 2021 18:59
battlmonstr pushed a commit that referenced this pull request Sep 14, 2023
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