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: make dial timeout longer #8599

Merged
merged 2 commits into from
Sep 23, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions etcdserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ func (c *ServerConfig) electionTimeout() time.Duration {
}

func (c *ServerConfig) peerDialTimeout() time.Duration {
// 1s for queue wait and system delay
// + one RTT, which is smaller than 1/5 election timeout
return time.Second + time.Duration(c.ElectionTicks)*time.Duration(c.TickMs)*time.Millisecond/5
// 1s for queue wait and election timeout
return time.Second + time.Duration(c.ElectionTicks)*time.Duration(c.TickMs)*time.Millisecond
Copy link
Member

Choose a reason for hiding this comment

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

I am curious why multiply ElectionTicks and TickMs time.Duration(c.ElectionTicks)*time.Duration(c.TickMs)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Generally looks good to me.

For readability, maybe go with:

time.Duration(c.ElectionTicks * c.TickMs)*time.Millisecond

This way we don't imply c.ElectionTicks is a duration (it's just count right?), until it's multiplied with the milliseconds per tick.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am curious why multiply ElectionTicks and TickMs

to get the duration. ticks is number of ticks. tickMS is duration per key. you can read the code around tick to understand this better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jpbetz fixed.

}

func (c *ServerConfig) PrintWithInitial() { c.print(true) }
Expand Down