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

EN-8343-optimize-trie-sync #2517

Merged
merged 3 commits into from Dec 4, 2020
Merged

Conversation

BeniaminDrasovean
Copy link
Contributor

Instead of keeping the whole trie in memory during the syncing process, and Commit() the trie when it is fully synced, only keep the collapsed root and commit each node individually as it is synced.

@@ -100,11 +100,6 @@ func (ts *trieSyncer) StartSyncing(rootHash []byte, ctx context.Context) error {

numUnResolved := ts.requestNodes()
if !shouldRetryAfterRequest && numUnResolved == 0 {
err = ts.trie.Commit()
Copy link
Contributor

Choose a reason for hiding this comment

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

why delete this ? isn't it better to have the final commit done ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we commit here, the whole trie will be loaded again from storage. The current approach is to commit each node as it is synced.

}

ts.trie.root = collapsedRoot
ts.rootFound = true
Copy link
Contributor

Choose a reason for hiding this comment

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

so we set root only after finding all its childs ?

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, it should have no impact upon the functioning of the algorithm.

@iulianpascalau iulianpascalau added type:bug Something isn't working type:feature New feature or request labels Nov 30, 2020
Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

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

System tests passed.

@LucianMincu LucianMincu merged commit bbb5359 into development Dec 4, 2020
@iulianpascalau iulianpascalau deleted the EN-8343-optimize-trie-syncer branch December 25, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants