Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Use monotonic clock in lease manager skew calculations #6940
Conversation
| if err := clockDoc.validate(); err != nil { | ||
| return nil, errors.Annotatef(err, "corrupt clock document") | ||
| } | ||
| // Create skew entries for each known writer... | ||
| - skews, err := clockDoc.skews(beginning, end) | ||
| + readTime := endRead - startRead | ||
| + skews, err := clockDoc.skews(beginning, beginning.Add(readTime*time.Nanosecond)) |
| err := f.Client.Refresh() | ||
| c.Assert(err, jc.ErrorIsNil) | ||
| } | ||
| -func (s *ClientNTPSuite) TestTimeGoesBackwardsALittle(c *gc.C) { | ||
| +func (s *ClientNTPSuite) TestTimeGoesBackwards(c *gc.C) { |
axw
Feb 8, 2017
Member
is this one of the tests you have to fix? because I don't think it makes sense anymore. we're only using the wall clock for the initial time stamp, so the step doesn't even come into play
| @@ -172,13 +172,8 @@ func (doc clockDoc) skews(beginning, end time.Time) (map[string]Skew, error) { | ||
| // If it isn't, it could be ntp rolling the clock back slowly, so we add |
axw
Feb 8, 2017
Member
this comment and check are irrelevant now? we're using a monotonic clock, so by definition this cannot happen
axw
Feb 8, 2017
Member
you didn't delete the check. it's not harmful, except it's second-guessing the definition of monotonicity
wallyworld
changed the title from
Allow for greater clock skew than 10ms in lease manager set up
to
Use monotonic clock in lease manager skew calculations
Feb 8, 2017
axw
approved these changes
Feb 8, 2017
LGTM. Would prefer if we didn't check end<beginning now, but I'll leave that up to you.
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
wallyworld commentedFeb 8, 2017
•
Edited 1 time
-
wallyworld
Feb 8, 2017
Description of change
A monotonic clock is introduced to the lease manager so that when it calculates skew, there is no possibility of time going backwards and causing an error.
QA steps
bootstrap and run list-models to smoke test
Bug reference
https://bugs.launchpad.net/juju/+bug/1662202