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

[Consensus] Follower engine message queue #3479

Merged

Conversation

durkmurder
Copy link
Member

@durkmurder durkmurder commented Oct 31, 2022

https://github.com/dapperlabs/flow-go/issues/6173

Context

This PR implements message queues and message processing on dedicated worker for follower engine. It also updates FollowerLoop to use component.ComponentManager instead of SingleRunner.
This PR is required to implement https://github.com/dapperlabs/flow-go/issues/6424 because follower engine and compliance engine need to implement the same interface.

Note on updating follower engine. This PR introduces message queues, proper implementation of component.Component interface and standalone startup of follower loop. Other changes will be handled in separate PR(like extracting interface for compliance engine).

Originally I didn't plan to implement standalone startup as part of this PR but observing that some nodes already start follower loop separately I've decided to implement this for other nodes otherwise it was resulting in double Start which is a panic.

Notable changes

  • Updated follower engine and follower loop to use ComponentManager
  • Updated FollowerLoop to work with buffered queues
  • Removed SingleRunner
  • Updated test suites

consensus/follower_test.go Show resolved Hide resolved
engine/common/follower/engine.go Outdated Show resolved Hide resolved
engine/common/follower/engine.go Outdated Show resolved Hide resolved
engine/common/follower/engine.go Outdated Show resolved Hide resolved
engine/common/follower/engine.go Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2022

Codecov Report

Merging #3479 (b988ad5) into feature/active-pacemaker (c02eefd) will decrease coverage by 11.56%.
The diff coverage is 0.00%.

❗ Current head b988ad5 differs from pull request most recent head c6a89c8. Consider uploading reports for the commit c6a89c8 to get more accurate results

@@                      Coverage Diff                      @@
##           feature/active-pacemaker    #3479       +/-   ##
=============================================================
- Coverage                     55.75%   44.18%   -11.57%     
=============================================================
  Files                           769      228      -541     
  Lines                         71245    25244    -46001     
=============================================================
- Hits                          39723    11155    -28568     
+ Misses                        28311    13070    -15241     
+ Partials                       3211     1019     -2192     
Flag Coverage Δ
unittests 44.18% <0.00%> (-11.57%) ⬇️

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

Impacted Files Coverage Δ
cmd/execution_builder.go 0.00% <0.00%> (ø)
cmd/verification_builder.go 0.00% <0.00%> (ø)
fvm/environment/contract_updater.go 66.88% <0.00%> (-0.66%) ⬇️
ledger/complete/wal/checkpointer.go 63.10% <0.00%> (-0.40%) ⬇️
engine/common/follower/engine.go
...rk/p2p/unicast/ratelimit/bandwidth_rate_limiter.go
engine/execution/convert.go
storage/badger/operation/computation_result.go
engine/access/rest/request/get_events.go
module/mempool/herocache/backdata/heropool/pool.go
... and 535 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@durkmurder durkmurder force-pushed the yurii/6173-follower-engine-message-queue branch from 93f89c9 to 8eda5c0 Compare November 1, 2022 18:09
@durkmurder
Copy link
Member Author

Originally I didn't plan to implement standalone startup as part of this PR but observing that some nodes already start follower loop separately I've decided to implement this for other nodes otherwise it was resulting in double Start which is a panic.

@@ -735,19 +738,12 @@ func (exeNode *ExecutionNode) LoadIngestionEngine(
return exeNode.ingestionEng, err
}

func (exeNode *ExecutionNode) LoadFollowerEngine(
func (exeNode *ExecutionNode) LoadConsensusCommittee(
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously we didn't start consensus committee it kinda worked in integration tests but generally speaking we would be missing some events without it

Copy link
Member

@AlexHentschel AlexHentschel left a comment

Choose a reason for hiding this comment

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

🎉

cmd/collection/main.go Outdated Show resolved Hide resolved
engine/common/follower/engine.go Outdated Show resolved Hide resolved
// No errors are expected during normal operation. All returned exceptions are potential
// symptoms of internal state corruption and should be fatal.
func (e *Engine) processQueuedBlocks() error {
for {
Copy link
Member

@AlexHentschel AlexHentschel Nov 17, 2022

Choose a reason for hiding this comment

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

should we add a termination check here? Like this:

select {
case <-doneSignal:
return nil
default:
}

Maybe best to append do PR #3512

durkmurder and others added 3 commits November 17, 2022 15:16
@durkmurder
Copy link
Member Author

bors merge

@bors bors bot merged commit ebe94af into feature/active-pacemaker Nov 17, 2022
@bors bors bot deleted the yurii/6173-follower-engine-message-queue branch November 17, 2022 13:37
This pull request was closed.
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.

4 participants