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 fixes #2570

Merged
merged 7 commits into from Dec 9, 2020
Merged

Trie sync fixes #2570

merged 7 commits into from Dec 9, 2020

Conversation

iulianpascalau
Copy link
Contributor

Added 2 fixes that will further improve trie synchronization when the node is in the bootstrap process

  • added dynamic timeouts when syncing trie nodes
  • made the trie syncer search in the trie database before requesting missing trie nodes

- made the trie syncer search in the trie database before requesting missing trie nodes
@iulianpascalau iulianpascalau self-assigned this Dec 9, 2020
@iulianpascalau iulianpascalau added type:bug Something isn't working type:feature New feature or request labels Dec 9, 2020
AdoAdoAdo
AdoAdoAdo previously approved these changes Dec 9, 2020
data/trie/sync.go Show resolved Hide resolved
data/trie/sync.go Outdated Show resolved Hide resolved
data/trie/sync.go Outdated Show resolved Hide resolved
data/trie/sync.go Show resolved Hide resolved
sasurobert
sasurobert previously approved these changes Dec 9, 2020
@@ -90,3 +90,9 @@ var ErrInvalidLevelValue = errors.New("invalid trie level in memory value")

// ErrNilTrieSyncStatistics signals that a nil trie sync statistics handler was provided
var ErrNilTrieSyncStatistics = errors.New("nil trie sync statistics handler")

// ErrContextClosing signals that the parent context requested the closing of its children
Copy link
Contributor

Choose a reason for hiding this comment

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

children of the corn :)

log.Trace("trie node intercepted", "hash", hash)

n, ok := ts.nodesForTrie[string(hash)]
if !ok || n.received {
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition is ok?

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 was moved from the sync.go file. Used only in unit tests. Guess it is ok as the node is ignored if it does not exists or already received

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

}
err = existingNode.setHash()
if err != nil {
return nil, ErrNodeNotFound
Copy link
Contributor

Choose a reason for hiding this comment

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

ErrNodeNotFound ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deliberately returned as ErrNodeNotFound because that will trigger a request (for some reason the node's hash was not computed)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

t.Parallel()

timeout := time.Second * 200
marsh, hasher := getTestMarshAndHasher()
Copy link
Contributor

Choose a reason for hiding this comment

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

marsh sounds weird, also in the method name

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

SebastianMarian
SebastianMarian previously approved these changes Dec 9, 2020
sasurobert
sasurobert previously approved these changes Dec 9, 2020
@LucianMincu LucianMincu merged commit a43de28 into development Dec 9, 2020
@iulianpascalau iulianpascalau deleted the fix-trie-sync branch December 25, 2020 14:33
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

6 participants