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

Sync watcher #814

Merged
merged 11 commits into from
Nov 30, 2018
Merged

Sync watcher #814

merged 11 commits into from
Nov 30, 2018

Conversation

anarcher
Copy link
Contributor

@anarcher anarcher commented Nov 25, 2018

Github Issue

Fixes #734

Background

sebak node watcher mode watches it's validators and try to sync. with this mode, the node don't join consensus.

$sebak node -h  | grep watcher
      --watcher-mode                    watcher mode
t=2018-11-25T03:16:32+0900 lvl=info msg="genesis block already created" module=main height=1 round=0 confirmed=2018-11-24T18:14:29.582518000+09:00 total-txs=1 total-ops=2 proposer=
t=2018-11-25T03:16:32+0900 lvl=info msg="Starting Sebak" module=main caller=run.go:498
t=2018-11-25T03:16:32+0900 lvl=info msg="syncer config" module=sync node=GBVG.MAIO poolSize=300 fetchTimeout=1m0s retryInterval=10s checkInterval=30s checkPrevBlockInterval=30s caller=config.go:118
t=2018-11-25T03:16:32+0900 lvl=info msg="starting syncer" module=sync node=GBVG.MAIO submodule=syncer caller=syncer.go:89
t=2018-11-25T03:16:32+0900 lvl=info msg="starting sync watcher" module=sync node=GBVG.MAIO submodule=watcher height=3338 caller=watcher.go:89
t=2018-11-25T03:19:57+0900 lvl=info msg="watched sync height" module=sync node=GBVG.MAIO submodule=watcher high=3391 last=3391 caller=watcher.go:109
t=2018-11-25T03:19:57+0900 lvl=info msg="updated highest height" module=sync node=GBVG.MAIO submodule=syncer height=3391 nodes=1 caller=syncer.go:156
t=2018-11-25T03:19:57+0900 lvl=info msg="sync progress" module=sync node=GBVG.MAIO submodule=syncer start=3391 cur=3391 high=3391 caller=syncer.go:214
t=2018-11-25T03:19:57+0900 lvl=info msg="done sync work" module=sync node=GBVG.MAIO submodule=syncer height=3391 hash=8kyrw2QTqk2cA39wE7HEocUKYKLk9trmRwG78fXaPtpp caller=syncer.go:275
t=2018-11-25T03:20:02+0900 lvl=info msg="done highest height and nodes" module=sync node=GBVG.MAIO submodule=watcher height=3393 nodes=[GAYGELM74WJMKSLDN5YP2VAMP64WC4IXIGICUNK2SCVIT7KPTLY7M3MW] caller=watcher.go:142

Solution

  • With watcher-mode, Node don't start InitRound. and start sync.Watcher.
  • For reciving Txs, watcher node send tx to one of validators.

Possible Drawbacks

  • A usecase of watcher mode, it can be stand-by validator. Same setting with --watcher-mode=1 can make standby validator. If active validator is down, we can change only --watcher-mode=0 for active validator. (maybe)

@anarcher anarcher added enhancement New feature or request sync labels Nov 25, 2018
@anarcher anarcher self-assigned this Nov 25, 2018
@anarcher anarcher added this to the Toward v0.1.0 milestone Nov 25, 2018
@codecov-io
Copy link

codecov-io commented Nov 25, 2018

Codecov Report

Merging #814 into master will decrease coverage by 1.31%.
The diff coverage is 3.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #814      +/-   ##
==========================================
- Coverage   61.97%   60.66%   -1.32%     
==========================================
  Files         151      152       +1     
  Lines        9913    10135     +222     
==========================================
+ Hits         6144     6148       +4     
- Misses       3109     3319     +210     
- Partials      660      668       +8
Flag Coverage Δ
#integration_tests_long_term 44.52% <3.13%> (-1.16%) ⬇️
#integration_tests_node 40.31% <3.13%> (-0.71%) ⬇️
#unittests 50.13% <1.34%> (-1.17%) ⬇️
Impacted Files Coverage Δ
lib/errors/errors.go 0% <ø> (ø) ⬆️
lib/node/runner/api_node.go 76.92% <ø> (ø) ⬆️
lib/common/config.go 100% <ø> (ø) ⬆️
lib/sync/watcher.go 0% <0%> (ø)
lib/node/runner/checker_message.go 55.43% <0%> (-20.69%) ⬇️
lib/node/node_state.go 80.76% <0%> (-14.69%) ⬇️
lib/node/local_node.go 87.01% <0%> (-2.33%) ⬇️
lib/sync/config.go 78.94% <0%> (-16.3%) ⬇️
lib/node/runner/node_runner.go 78.1% <33.33%> (-0.67%) ⬇️
cmd/sebak/cmd/run.go 65.06% <35.71%> (-0.93%) ⬇️
... and 7 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 11b19a7...4f87269. Read the comment docs.

Copy link
Contributor

@spikeekips spikeekips left a comment

Choose a reason for hiding this comment

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

Super fast impl. 👍

cmd/sebak/cmd/run.go Outdated Show resolved Hide resolved
lib/node/runner/api_node.go Outdated Show resolved Hide resolved
lib/sync/types.go Outdated Show resolved Hide resolved
lib/node/runner/checker_message.go Outdated Show resolved Hide resolved
lib/node/runner/checker_message.go Show resolved Hide resolved
lib/sync/watcher.go Show resolved Hide resolved
lib/sync/watcher.go Show resolved Hide resolved
Copy link
Member

@Charleslee522 Charleslee522 left a comment

Choose a reason for hiding this comment

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

Some comments, I want to have more time for this :)

lib/node/runner/checker_message.go Show resolved Hide resolved
@anarcher anarcher force-pushed the sync-watcher branch 2 times, most recently from 69f347a to 4f87269 Compare November 28, 2018 06:56
@anarcher
Copy link
Contributor Author

Ping @Charleslee522 :-> Plz review it :->

Copy link
Member

@Charleslee522 Charleslee522 left a comment

Choose a reason for hiding this comment

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

LGTM!

@anarcher anarcher merged commit 445eaa7 into bosnet:master Nov 30, 2018
@anarcher anarcher deleted the sync-watcher branch November 30, 2018 06:23
@anarcher anarcher restored the sync-watcher branch December 1, 2018 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Watcher node mode
5 participants