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

Able to Disable Worker #688

Merged
merged 6 commits into from
Oct 8, 2020
Merged

Able to Disable Worker #688

merged 6 commits into from
Oct 8, 2020

Conversation

joowon-byun
Copy link
Contributor

Proposed changes

  • Able to disable worker
    • Made a new struct FakeWorker
    • Made a new flag worker.disable

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

Further comments

cmd/utils/flags.go Outdated Show resolved Hide resolved
// set worker
if config.WorkerDisable {
cn.miner = work.NewFakeWorker()
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Disable daemon when WorkerDisable flag is given?

Copy link
Contributor

@ehnuje ehnuje Sep 24, 2020

Choose a reason for hiding this comment

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

Not only daemon, whole statements in else should be pulled out.
Please ignore this comment.

@ehnuje
Copy link
Contributor

ehnuje commented Sep 24, 2020

Please run local test before pushing PR to github repo.

cmd.Run()
// set worker
if config.WorkerDisable {
cn.miner = work.NewFakeWorker()
Copy link
Contributor

Choose a reason for hiding this comment

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

What is difference between the woker and fake woker for EN, KES, PN ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we use fake worker, istanbul backend is set but not started. If this happens, some of the validator functions are not working correctly, no handling a new round and so on.
EN, KES and PN needs worker to run.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please leave a TODO comment that we should implement auto restart feature when the fake worker is used.

Copy link
Member

Choose a reason for hiding this comment

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

@ehnuje auto-restart is a little tricky. Auto-restart feature was for CNs, but CNs should not use the fake worker.

Copy link
Contributor

Choose a reason for hiding this comment

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

@aidan-kwon Right. When I discussed this with @winnie-byun, we decided that auto-restart does not need to be implemented in the Klaytn code. This can be done by checking the liveness of the pod.

@joowon-byun
Copy link
Contributor Author

Dear reviewers, I found an error while testing. I will inform you when I resolve it.

@KimKyungup KimKyungup marked this pull request as draft October 5, 2020 06:16
@joowon-byun
Copy link
Contributor Author

Dear reviewers,

Disabling worker results in block processing failure.
However, we are planning to load blocks withou processing them.
I will test this PR after PR#698.

APIs regrading to proposers and validators are loaded from headers.
Therefore, it looks okay to disable workers.

I will inform you again after testing.

@KimKyungup
Copy link
Contributor

Disabling worker results in block processing failure.

Please share the failure case log or reason?

aidan-kwon
aidan-kwon previously approved these changes Oct 6, 2020
@joowon-byun
Copy link
Contributor Author

@KimKyungup The fail case occured due to block processing failure.
disable worker -> istanbul not started -> wrong value returned from block prcessing -> failed to validate
The log shows invalid merkle root because the validation is failed.

Dear reviewers, talking to @aidan-kwon, we've decided to merge this PR before testing PR#698 for conveince.
PTAL :)

work/worker_fake.go Outdated Show resolved Hide resolved
cmd.Run()
// set worker
if config.WorkerDisable {
cn.miner = work.NewFakeWorker()
Copy link
Contributor

Choose a reason for hiding this comment

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

Please leave a TODO comment that we should implement auto restart feature when the fake worker is used.

@joowon-byun
Copy link
Contributor Author

@KimKyungup @jeongkyun-oh @yoomee1313 PTAL :)

@joowon-byun joowon-byun marked this pull request as ready for review October 8, 2020 05:24
@joowon-byun joowon-byun merged commit 989225d into klaytn:dev Oct 8, 2020
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

5 participants