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

Issue 7058073: state: EnterScope fixes

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

Description

state: EnterScope fixes EnterScope now takes a settings map, which is used to create or overwrite the unit relation settings, if and only if a scope document does not already exist. The overwriting improves the behaviour of units which leave and then enter the same scope, by preventing stale settings from confusing remote units. In addition, RelationUnit no longer has an annoyingly hidden dependency on the unit's private address; this makes it easier to create a subordinate, and consequently makes the removal of AddUnitSubordinateTo more manageable. https://code.launchpad.net/~fwereade/juju-core/untangle-enter-scope/+merge/142657 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 14

Patch Set 2 : state: EnterScope fixes #

Total comments: 5

Patch Set 3 : state: EnterScope fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+295 lines, -222 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M juju/conn_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/relation.go View 1 2 3 chunks +119 lines, -88 lines 0 comments Download
M state/relation_test.go View 1 39 chunks +93 lines, -67 lines 0 comments Download
M state/service_test.go View 1 2 chunks +3 lines, -7 lines 0 comments Download
M state/settings.go View 1 2 2 chunks +44 lines, -6 lines 0 comments Download
M state/unit_test.go View 1 1 chunk +1 line, -3 lines 0 comments Download
M worker/deployer/deployer_test.go View 3 chunks +4 lines, -7 lines 0 comments Download
M worker/uniter/context_test.go View 1 6 chunks +10 lines, -20 lines 0 comments Download
M worker/uniter/filter_test.go View 1 chunk +1 line, -3 lines 0 comments Download
M worker/uniter/relationer.go View 1 1 chunk +5 lines, -1 line 0 comments Download
M worker/uniter/relationer_test.go View 1 5 chunks +9 lines, -11 lines 0 comments Download
M worker/uniter/uniter_test.go View 1 2 chunks +3 lines, -8 lines 0 comments Download

Messages

Total messages: 8
fwereade
Please take a look.
11 years, 3 months ago (2013-01-10 10:10:40 UTC) #1
TheMue
Looks nice, only one real comment now. But have to dig deeper into it. https://codereview.appspot.com/7058073/diff/1/state/relation.go ...
11 years, 3 months ago (2013-01-11 16:03:04 UTC) #2
fwereade
Thanks TheMue. Thoughts on the below? https://codereview.appspot.com/7058073/diff/1/state/relation.go File state/relation.go (right): https://codereview.appspot.com/7058073/diff/1/state/relation.go#newcode308 state/relation.go:308: settingsChanged := func() ...
11 years, 3 months ago (2013-01-14 07:55:18 UTC) #3
fwereade
Hmm: I am starting to think that we should return ErrAlreadyInScope to make explicit the ...
11 years, 3 months ago (2013-01-14 14:49:51 UTC) #4
rog
nice. LGTM with the below remarks addressed. i'm not sure what you were referring to ...
11 years, 3 months ago (2013-01-15 10:10:18 UTC) #5
fwereade
Please take a look.
11 years, 3 months ago (2013-01-15 14:06:45 UTC) #6
TheMue
LGTM https://codereview.appspot.com/7058073/diff/7002/state/relation.go File state/relation.go (right): https://codereview.appspot.com/7058073/diff/7002/state/relation.go#newcode401 state/relation.go:401: func (ru *RelationUnit) subordinateOps() ([]txn.Op, string, error) { ...
11 years, 3 months ago (2013-01-15 14:39:20 UTC) #7
fwereade
11 years, 3 months ago (2013-01-15 16:48:13 UTC) #8
*** Submitted:

state: EnterScope fixes

EnterScope now takes a settings map, which is used to create or overwrite
the unit relation settings, if and only if a scope document does not
already exist. The overwriting improves the behaviour of units which leave
and then enter the same scope, by preventing stale settings from confusing
remote units.

In addition, RelationUnit no longer has an annoyingly hidden dependency on
the unit's private address; this makes it easier to create a subordinate,
and consequently makes the removal of AddUnitSubordinateTo more manageable.

R=TheMue, rog
CC=
https://codereview.appspot.com/7058073

https://codereview.appspot.com/7058073/diff/1/state/relation.go
File state/relation.go (right):

https://codereview.appspot.com/7058073/diff/1/state/relation.go#newcode368
state/relation.go:368: t := fmt.Sprintf("cannot enter scope for unit %q in
relation %q", ru.unit, ru.relation) + ": %v"
On 2013/01/15 10:10:18, rog wrote:
> rather than constructing a format string that can't be checked by govet, i
think
> it would be better to lose the %v and just not use Errorf, e.g. errors.New(t +
> ": concurrent settings change detected")
> 
> (or put the : in t)

Done.

https://codereview.appspot.com/7058073/diff/1/state/relation.go#newcode377
state/relation.go:377: return fmt.Errorf(t, "inconsistent state")
On 2013/01/15 10:10:18, rog wrote:
> "inconsistent state in EnterScope" ?

Done.

https://codereview.appspot.com/7058073/diff/1/state/relation.go#newcode389
state/relation.go:389: } else if len(related) != 1 {
On 2013/01/15 10:10:18, rog wrote:
> the else isn't necessary here.

Done.

https://codereview.appspot.com/7058073/diff/1/state/settings.go
File state/settings.go (right):

https://codereview.appspot.com/7058073/diff/1/state/settings.go#newcode263
state/settings.go:263: for k, _ := range s.disk {
On 2013/01/15 10:10:18, rog wrote:
> s/, _//

Done.

https://codereview.appspot.com/7058073/diff/7002/state/settings.go
File state/settings.go (right):

https://codereview.appspot.com/7058073/diff/7002/state/settings.go#newcode263
state/settings.go:263: for k, _ := range s.disk {
On 2013/01/15 14:39:21, TheMue wrote:
> _ not needed.

Done.

https://codereview.appspot.com/7058073/diff/7002/worker/uniter/uniter_test.go
File worker/uniter/uniter_test.go (right):

https://codereview.appspot.com/7058073/diff/7002/worker/uniter/uniter_test.go...
worker/uniter/uniter_test.go:1342: timeout := time.After(5 * time.Second)
On 2013/01/15 14:39:21, TheMue wrote:
> Had to read twice to get the idea of timeout and polling.

Absent suggestions for improvement, merging as-is.
Sign in to reply to this message.

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