Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4191)

Issue 6588053: uniter: integrate filter type

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 6 months ago by fwereade
Modified:
11 years, 6 months ago
Reviewers:
mp+127159
Visibility:
Public.

Description

uniter: integrate filter type By tweaking the filter slightly, to provide more carefully-tailored events, the uniter Modes have been radically simplified. Note that state.Unit was previously mis-specified, and is now fixed: it's fine (in fact, potentially necessary) to resolve errors when the unit is Dying. Also note that there are roughly 50% more full Uniter tests than the previous branch, but they run in roughly the same amount of time. Win! But! This is actually a significant slowdown, because I fixed a bunch of happy-path 500ms waits in the uniter tests. It's true that this variant does more unnecessary work in the service of simpler Mode code, and I haven't been able to find any obvious hotspots (apart from the pre-existing one) so if reviewers would bear subtle performance implications in mind I would be most grateful :). https://code.launchpad.net/~fwereade/juju-core/uniter-use-filter/+merge/127159 Requires: https://code.launchpad.net/~fwereade/juju-core/uniter-filter-type/+merge/127142 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : uniter: integrate filter type #

Total comments: 27

Patch Set 3 : uniter: integrate filter type #

Patch Set 4 : uniter: integrate filter type #

Patch Set 5 : uniter: integrate filter type #

Total comments: 8

Patch Set 6 : uniter: integrate filter type #

Total comments: 12

Patch Set 7 : uniter: integrate filter type #

Unified diffs Side-by-side diffs Delta from patch set Stats (+715 lines, -571 lines) Patch
A [revision details] View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M state/unit.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M state/unit_test.go View 1 2 1 chunk +17 lines, -7 lines 0 comments Download
M worker/uniter/filter.go View 1 2 3 4 5 6 1 chunk +254 lines, -200 lines 0 comments Download
M worker/uniter/filter_test.go View 1 2 3 4 5 8 chunks +77 lines, -70 lines 0 comments Download
M worker/uniter/modes.go View 1 2 3 4 5 9 chunks +147 lines, -175 lines 0 comments Download
M worker/uniter/uniter.go View 1 2 3 4 5 6 chunks +45 lines, -28 lines 0 comments Download
M worker/uniter/uniter_test.go View 1 2 13 chunks +172 lines, -90 lines 0 comments Download

Messages

Total messages: 14
fwereade
Please take a look.
11 years, 6 months ago (2012-09-30 20:04:18 UTC) #1
rog
LGTM - very nice improvements. https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go File worker/uniter/modes.go (right): https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go#newcode159 worker/uniter/modes.go:159: return nil, fmt.Errorf("insane uniter ...
11 years, 6 months ago (2012-10-01 11:02:58 UTC) #2
niemeyer
That's a great CL. Probably ready after this round: https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go File worker/uniter/modes.go (right): https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go#newcode165 worker/uniter/modes.go:165: ...
11 years, 6 months ago (2012-10-01 22:47:33 UTC) #3
fwereade
Thanks again. Nothing controversial, I think :). https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go File worker/uniter/modes.go (right): https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go#newcode165 worker/uniter/modes.go:165: // Execute ...
11 years, 6 months ago (2012-10-02 07:01:35 UTC) #4
niemeyer
https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go File worker/uniter/modes.go (right): https://codereview.appspot.com/6588053/diff/2001/worker/uniter/modes.go#newcode296 worker/uniter/modes.go:296: *next, *err = ModeHookError, nil On 2012/10/02 07:01:35, fwereade ...
11 years, 6 months ago (2012-10-02 14:12:58 UTC) #5
fwereade
Responses to comments I missed before. Hopefully nothing too controversial? https://codereview.appspot.com/6588053/diff/2001/worker/uniter/uniter.go File worker/uniter/uniter.go (right): https://codereview.appspot.com/6588053/diff/2001/worker/uniter/uniter.go#newcode1 ...
11 years, 6 months ago (2012-10-02 20:22:07 UTC) #6
niemeyer
https://codereview.appspot.com/6588053/diff/2001/worker/uniter/uniter.go File worker/uniter/uniter.go (right): https://codereview.appspot.com/6588053/diff/2001/worker/uniter/uniter.go#newcode150 worker/uniter/uniter.go:150: case <-u.unitDying(): On 2012/10/02 20:22:07, fwereade wrote: > On ...
11 years, 6 months ago (2012-10-02 22:44:34 UTC) #7
fwereade
Please take a look.
11 years, 6 months ago (2012-10-04 13:31:04 UTC) #8
fwereade
It crosses my mind, incidentally, that all these charm events are actually upgrade events. I ...
11 years, 6 months ago (2012-10-04 13:34:32 UTC) #9
fwereade
Please take a look.
11 years, 6 months ago (2012-10-04 13:38:21 UTC) #10
niemeyer
Some awesome progress here. A few comments: https://codereview.appspot.com/6588053/diff/14001/worker/uniter/filter.go File worker/uniter/filter.go (right): https://codereview.appspot.com/6588053/diff/14001/worker/uniter/filter.go#newcode64 worker/uniter/filter.go:64: unitChanged := ...
11 years, 6 months ago (2012-10-04 17:48:11 UTC) #11
fwereade
Please take a look. https://codereview.appspot.com/6588053/diff/14001/worker/uniter/filter.go File worker/uniter/filter.go (right): https://codereview.appspot.com/6588053/diff/14001/worker/uniter/filter.go#newcode64 worker/uniter/filter.go:64: unitChanged := func() error { ...
11 years, 6 months ago (2012-10-04 21:56:35 UTC) #12
niemeyer
LGTM, with a few last suggestions for your consideration: https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go File worker/uniter/filter.go (right): https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go#newcode34 worker/uniter/filter.go:34: ...
11 years, 6 months ago (2012-10-04 22:39:56 UTC) #13
fwereade
11 years, 6 months ago (2012-10-05 00:00:19 UTC) #14
*** Submitted:

uniter: integrate filter type

By tweaking the filter slightly, to provide more carefully-tailored events,
the uniter Modes have been radically simplified.

Note that state.Unit was previously mis-specified, and is now fixed: it's
fine (in fact, potentially necessary) to resolve errors when the unit is
Dying.

Also note that there are roughly 50% more full Uniter tests than the
previous branch, but they run in roughly the same amount of time. Win!
But! This is actually a significant slowdown, because I fixed a bunch of
happy-path 500ms waits in the uniter tests. It's true that this variant does
more unnecessary work in the service of simpler Mode code, and I haven't been
able to find any obvious hotspots (apart from the pre-existing one) so if
reviewers would bear subtle performance implications in mind I would be most
grateful :).

R=rog, niemeyer
CC=
https://codereview.appspot.com/6588053

https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go
File worker/uniter/filter.go (right):

https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go#new...
worker/uniter/filter.go:34: // The want* chans are used to indicate that the
filter should sent
On 2012/10/04 22:39:56, niemeyer wrote:
> s/sent/send/

Done.

https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go#new...
worker/uniter/filter.go:44: rm          state.ResolvedMode
On 2012/10/04 22:39:56, niemeyer wrote:
> Can we have this as "resolved"?

Done.

https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go#new...
worker/uniter/filter.go:48: gotForce    bool
On 2012/10/04 22:39:56, niemeyer wrote:
> I'm finding slightly hard to read the code involving those variable names as
> intended. I suggest something like this instead:
> 
> var upgradeRequested serviceCharm
> var upgradeAvailable serviceCharm
> 
> type serviceCharm struct {
>     url   *charm.URL
>     force bool
> }

Done.

https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go#new...
worker/uniter/filter.go:170: // event to be sent explicitly).
On 2012/10/04 22:39:56, niemeyer wrote:
> This is alluding to the problem without explaining it. This describes the
issue
> more directly:
> 
> // Consume first event so that this sequence doesn't happen:
> //
> // 1) WantConfigEvent called; channel unblocked
> // 2) Config event sent
> // 3) Initial config event received; channel unblocked
> // 4) Config event sent again, for the same configuration

Done.

https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go#new...
worker/uniter/filter.go:221: // On request, ensure that if an event is available
it will be resent.
On 2012/10/04 22:39:56, niemeyer wrote:
> // Handle explicit requests for events.
> 
> (this is not necessarily about *resending*)

Done.

https://codereview.appspot.com/6588053/diff/17001/worker/uniter/filter.go#new...
worker/uniter/filter.go:296: log.Debugf("filter: no new charm event")
On 2012/10/04 22:39:56, niemeyer wrote:
> This doesn't sound right. There's a path above that unblocks the channel and
we
> get here even then.

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b