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

etcdserver: initialize raftNode with constructor #7757

Merged
merged 1 commit into from
Apr 18, 2017

Conversation

heyitsanthony
Copy link
Contributor

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

@@ -94,14 +94,7 @@ type raftNode struct {
term uint64
lead uint64

mu sync.Mutex
// last lead elected time
lt time.Time
Copy link
Contributor

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?

Copy link
Contributor Author

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.

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
Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

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

lgtm. thanks

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@8fdf8f7). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #7757   +/-   ##
=========================================
  Coverage          ?   75.94%           
=========================================
  Files             ?      331           
  Lines             ?    26062           
  Branches          ?        0           
=========================================
  Hits              ?    19794           
  Misses            ?     4847           
  Partials          ?     1421
Impacted Files Coverage Δ
etcdserver/server.go 80.02% <100%> (ø)
etcdserver/raft.go 88.39% <100%> (ø)

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 8fdf8f7...714b48a. Read the comment docs.

@xiang90
Copy link
Contributor

xiang90 commented Apr 18, 2017

lgtm

@heyitsanthony heyitsanthony merged commit cb408ac into etcd-io:master Apr 18, 2017
@heyitsanthony heyitsanthony deleted the fix-speedy-close branch April 18, 2017 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants