-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
etcdserver: initialize raftNode with constructor #7757
Conversation
d3127c3
to
17ad654
Compare
@@ -94,14 +94,7 @@ type raftNode struct { | |||
term uint64 | |||
lead uint64 | |||
|
|||
mu sync.Mutex | |||
// last lead elected time | |||
lt time.Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to move this variable around in this pr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying the structure around copies the mutex which causes the static checks to complain.
17ad654
to
714b48a
Compare
raftNode was being initialized in start(), which was causing hangs when trying to stop the etcd server since the stop channel would not be initialized in time for the stop call. Instead, setup non-configurable bits in a constructor. Fixes etcd-io#7668
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. thanks
Codecov Report
@@ Coverage Diff @@
## master #7757 +/- ##
=========================================
Coverage ? 75.94%
=========================================
Files ? 331
Lines ? 26062
Branches ? 0
=========================================
Hits ? 19794
Misses ? 4847
Partials ? 1421
Continue to review full report at Codecov.
|
lgtm |
raftNode was being initialized in start(), which was causing
hangs when trying to stop the etcd server since the stop channel
would not be initialized in time for the stop call. Instead,
setup non-configurable bits in a constructor.
Fixes #7668