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

Trie sync optimization #2888

Merged
merged 20 commits into from
Apr 8, 2021
Merged

Conversation

iulianpascalau
Copy link
Contributor

@iulianpascalau iulianpascalau commented Mar 4, 2021

  • created a new optimized trie syncer
  • added the possibility to switch from the 2 implementations from the config lines
  • made the trie sync integration tests use real file-based storers

@codecov
Copy link

codecov bot commented Mar 4, 2021

Codecov Report

Merging #2888 (b7d097b) into feat/trie-sync-fixes (ac891a0) will increase coverage by 0.06%.
The diff coverage is 87.36%.

❗ Current head b7d097b differs from pull request most recent head af7fde2. Consider uploading reports for the commit af7fde2 to get more accurate results
Impacted file tree graph

@@                   Coverage Diff                    @@
##           feat/trie-sync-fixes    #2888      +/-   ##
========================================================
+ Coverage                 74.91%   74.97%   +0.06%     
========================================================
  Files                       613      615       +2     
  Lines                     58645    58857     +212     
========================================================
+ Hits                      43933    44130     +197     
- Misses                    10783    10789       +6     
- Partials                   3929     3938       +9     
Impacted Files Coverage Δ
data/trie/node.go 84.00% <ø> (ø)
dataRetriever/interface.go 0.00% <ø> (ø)
storage/fifocache/fifocacheSharded.go 84.61% <0.00%> (-2.23%) ⬇️
storage/immunitycache/cache.go 95.61% <0.00%> (-0.85%) ⬇️
storage/lrucache/capacity/capacityLRUCache.go 94.01% <0.00%> (-2.48%) ⬇️
storage/lrucache/lrucache.go 90.38% <0.00%> (-1.78%) ⬇️
storage/lrucache/simpleLRUCacheAdapter.go 66.66% <0.00%> (-33.34%) ⬇️
storage/txcache/disabledCache.go 87.50% <0.00%> (-5.84%) ⬇️
storage/txcache/txCache.go 97.95% <0.00%> (-1.01%) ⬇️
epochStart/bootstrap/process.go 54.09% <60.00%> (+0.05%) ⬆️
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ba5a18...af7fde2. Read the comment docs.

@iulianpascalau iulianpascalau marked this pull request as draft March 4, 2021 20:35
- made the trie sync tests use real life storers
@iulianpascalau iulianpascalau marked this pull request as ready for review March 7, 2021 18:54
data/interface.go Outdated Show resolved Hide resolved
data/mock/trieStub.go Outdated Show resolved Hide resolved
data/trie/branchNode.go Outdated Show resolved Hide resolved
data/trie/branchNode.go Outdated Show resolved Hide resolved
data/trie/branchNode.go Outdated Show resolved Hide resolved
data/trie/extensionNode.go Outdated Show resolved Hide resolved
data/trie/patriciaMerkleTrie.go Outdated Show resolved Hide resolved
data/trie/patriciaMerkleTrie.go Show resolved Hide resolved
cmd/node/config/config.toml Outdated Show resolved Hide resolved
data/trie/branchNode.go Outdated Show resolved Hide resolved
data/trie/branchNode.go Outdated Show resolved Hide resolved
data/trie/doubleListSync.go Outdated Show resolved Hide resolved
data/trie/doubleListSync.go Show resolved Hide resolved

delete(dlts.marginMissing, hash)

dlts.marginExisting[string(n.getHash())] = n
Copy link
Contributor

Choose a reason for hiding this comment

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

why margin ? it could be simply existing and missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it better explains that when we are traversing the trie we are holding and processing a virtual "margin" of nodes. The nodes closer to the root node are already processed and not present in the lists, the nodes closer to the leaves will be included in the margin lists and will be processed. After that they will be removed. For clarity I would keep the "margin" term.

Copy link
Contributor

Choose a reason for hiding this comment

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

margin is clear for you. it does not necessary mean for clarity for others 🗡️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed

data/trie/doubleListSync.go Outdated Show resolved Hide resolved
data/trie/extensionNode.go Outdated Show resolved Hide resolved
data/trie/patriciaMerkleTrie.go Show resolved Hide resolved
dataRetriever/requestHandlers/requestHandler.go Outdated Show resolved Hide resolved
dataRetriever/resolvers/trieNodeResolver.go Outdated Show resolved Hide resolved
sasurobert
sasurobert previously approved these changes Mar 10, 2021
sasurobert
sasurobert previously approved these changes Mar 15, 2021
iulianpascalau and others added 3 commits March 18, 2021 15:12
# Conflicts:
#	data/syncer/userAccountsSyncer.go
#	data/trie/branchNode.go
#	data/trie/branchNode_test.go
#	data/trie/extensionNode.go
#	data/trie/extensionNode_test.go
#	data/trie/interface.go
#	data/trie/leafNode.go
#	data/trie/sync.go
@iulianpascalau iulianpascalau changed the base branch from master to more-tries-sync-fixes April 8, 2021 10:28
Base automatically changed from more-tries-sync-fixes to feat/trie-sync-fixes April 8, 2021 12:32
@iulianpascalau iulianpascalau merged commit 27ccd56 into feat/trie-sync-fixes Apr 8, 2021
@iulianpascalau iulianpascalau deleted the trie-sync-optimization branch April 8, 2021 12:47
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.

None yet

3 participants