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

[Verification] rolls-in persistent architecture #728

Merged
merged 591 commits into from Jun 11, 2021

Conversation

yhassanzadeh13
Copy link
Contributor

@yhassanzadeh13 yhassanzadeh13 commented May 19, 2021

This PR refactors the cmd/verification/main.go to roll-in the new verification architecture and replace the current engines with the new ones. We however let the old architecture stay on master for a while passively. This lets rolling back the architecture by just rolling back the main file (mainly). We clean the old components in this issue https://github.com/dapperlabs/flow-go/issues/5548 later.

yhassanzadeh13 and others added 30 commits April 19, 2021 10:18
@@ -94,9 +94,6 @@ func (e *Engine) WithChunkConsumerNotifier(notifier module.ProcessingNotifier) {

// Ready initializes the engine and returns a channel that is closed when the initialization is done
func (e *Engine) Ready() <-chan struct{} {
if e.chunkConsumerNotifier == nil {
e.log.Fatal().Msg("missing chunk consumer notifier callback in verification fetcher engine")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason for this change is to resolve a cyclic dependency that causes node crash on startup:

Hence, we discard this checking and rely on the fact that similar to any other component of a node, missing a chunkConsumerNotifier literally leads the node to crash with panic upon processing the first chunk. This is the same strategy we take about other components, e.g., network, which missing assignment of that on a node panics the first time node tries sending a message.

The other solution would be to decouple the component initialization and startup on the scaffold, but not sure of its side effects on other nodes (considerable on a separate PR).

Copy link
Member

Choose a reason for hiding this comment

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

This seems like it will introduce a race condition at startup where sometimes the node will crash. I don't think the network component has the same behaviour (it may error before the mesh network is set up but it won't crash the node). It would be better to avoid this if we can.

What we do for some other engines with a similar dependency structure (eg. epochmgr, compliance) is embed the dependency within the engine and have the engine manage the lifecycle of the dependency. Then both the dependency and the engine can be instantiated in one Component block in the scaffold.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9559281 and 892598a

@yhassanzadeh13 yhassanzadeh13 marked this pull request as ready for review May 19, 2021 19:42
@yhassanzadeh13 yhassanzadeh13 requested review from zhangchiqing and jordanschalm and removed request for vishalchangrani and ramtinms May 19, 2021 19:42
Copy link
Member

@jordanschalm jordanschalm left a comment

Choose a reason for hiding this comment

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

Looks good besides the dependency issue I commented yesterday. Just noticed that appeared as a single comment rather than review

Copy link
Member

@zhangchiqing zhangchiqing left a comment

Choose a reason for hiding this comment

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

Looks good

@yhassanzadeh13 yhassanzadeh13 force-pushed the yahya/5521-roll-in-new-verificaiton branch from e6a748e to 892598a Compare May 20, 2021 22:01
@@ -97,7 +97,9 @@ func (e *Engine) Ready() <-chan struct{} {
if e.chunkConsumerNotifier == nil {
e.log.Fatal().Msg("missing chunk consumer notifier callback in verification fetcher engine")
}
return e.unit.Ready()
return e.unit.Ready(func() {
<-e.requester.Ready()
Copy link
Member

Choose a reason for hiding this comment

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

Should do <-e.requester.Done() in Done method so teardown is handled as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 1cd712e

@codecov-commenter
Copy link

codecov-commenter commented May 31, 2021

Codecov Report

Merging #728 (9cd3053) into master (0272226) will increase coverage by 0.00%.
The diff coverage is 42.85%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #728   +/-   ##
=======================================
  Coverage   56.44%   56.45%           
=======================================
  Files         426      426           
  Lines       25049    25052    +3     
=======================================
+ Hits        14140    14142    +2     
- Misses       8995     8998    +3     
+ Partials     1914     1912    -2     
Flag Coverage Δ
unittests 56.45% <42.85%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ne/verification/assigner/blockconsumer/consumer.go 76.31% <ø> (ø)
engine/verification/fetcher/engine.go 76.51% <0.00%> (-1.67%) ⬇️
...ine/verification/fetcher/chunkconsumer/consumer.go 84.21% <100.00%> (-2.16%) ⬇️
engine/verification/match/engine.go 66.18% <0.00%> (+1.07%) ⬆️
engine/verification/match/chunks.go 90.00% <0.00%> (+6.66%) ⬆️

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 0272226...9cd3053. Read the comment docs.

@yhassanzadeh13 yhassanzadeh13 merged commit d5a3844 into master Jun 11, 2021
@yhassanzadeh13 yhassanzadeh13 deleted the yahya/5521-roll-in-new-verificaiton branch June 11, 2021 20:58
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

4 participants