Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(133)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 49920045: worker/peergrouper: new package

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years ago by rog
Modified:
12 years ago
Reviewers:
mp+201245, jameinel, natefinch
Visibility:
Public.
worker/peergrouper: new package This will be a worker that maintains the replica set with respect to the state. The function in this CL implements the core functionality - it's a stateless function that looks at a representation of the current state of affairs and decides what the replicaset member list should look like. It may well change when faced with reality (although I've been trying to sanity check with experimental code), but I think it should be reasonable to check in now as a staging post. There are current some extraneous changes in this branch (everything outside worker/peergrouper) which are made redundant by other MPs. Please ignore for the purposes of this review; I'll remove before submitting. https://code.launchpad.net/~rogpeppe/juju-core/479-desired-peer-group/+merge/201245 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : worker/peergrouper: new package #

Total comments: 6

Patch Set 3 : worker/peergrouper: new package #

Patch Set 4 : worker/peergrouper: new package #

Patch Set 5 : worker/peergrouper: new package #

Total comments: 4

Patch Set 6 : worker/peergrouper: new package #

Patch Set 7 : worker/peergrouper: new package #

Created: 12 years ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+656 lines, -0 lines) Patch
A [revision details] View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M replicaset/replicaset.go View 1 2 2 chunks +6 lines, -0 lines 0 comments Download
A worker/peergrouper/desired.go View 1 2 3 4 5 1 chunk +290 lines, -0 lines 0 comments Download
A worker/peergrouper/desired_test.go View 1 2 3 4 5 6 1 chunk +358 lines, -0 lines 0 comments Download
Total messages: 8
|
rog
Please take a look.
12 years ago (2014年01月10日 19:07:31 UTC) #1
Please take a look.
Sign in to reply to this message.
jameinel
I didn't finish the review before I'm on the next call, but some thoughts I ...
12 years ago (2014年01月13日 11:37:11 UTC) #2
I didn't finish the review before I'm on the next call, but some thoughts I
didn't want to lose.
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired.go
File worker/peergrouper/desired.go (right):
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired...
worker/peergrouper/desired.go:32: //func getPeerGroupInfo(st *state.State, ms
[]*state.Machine) (*peerGroupInfo, error) {
this function is commented out. Generally either we should delete it, or have
it. I'm guessing this is just part of the process as you're getting there.
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired...
worker/peergrouper/desired.go:58: return j
Is there really nothing like min that we can just use?
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired...
worker/peergrouper/desired.go:66: func desiredPeerGroup(info *peerGroupInfo)
([]replicaset.Member, error) {
Your description makes it sound like this function mixes a query (what peer
group do you want?) with an action (set the voting status of all the machines).
It would be best to split informational queries from side effects if possible.
Sign in to reply to this message.
rog
Please take a look. https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired.go File worker/peergrouper/desired.go (right): https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired.go#newcode32 worker/peergrouper/desired.go:32: //func getPeerGroupInfo(st *state.State, ms []*state.Machine) ...
12 years ago (2014年01月13日 17:40:12 UTC) #3
Please take a look.
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired.go
File worker/peergrouper/desired.go (right):
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired...
worker/peergrouper/desired.go:32: //func getPeerGroupInfo(st *state.State, ms
[]*state.Machine) (*peerGroupInfo, error) {
On 2014年01月13日 11:37:12, jameinel wrote:
> this function is commented out. Generally either we should delete it, or have
> it. I'm guessing this is just part of the process as you're getting there.
It is. I suppose I should probably delete it for this CL and bring it back in
the next one.
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired...
worker/peergrouper/desired.go:58: return j
On 2014年01月13日 11:37:12, jameinel wrote:
> Is there really nothing like min that we can just use?
nope. it's not considered worth adding to the standard library.
(well, it wouldn't be one - there would be 12 of them).
https://codereview.appspot.com/49920045/diff/20001/worker/peergrouper/desired...
worker/peergrouper/desired.go:66: func desiredPeerGroup(info *peerGroupInfo)
([]replicaset.Member, error) {
On 2014年01月13日 11:37:12, jameinel wrote:
> Your description makes it sound like this function mixes a query (what peer
> group do you want?) with an action (set the voting status of all the
machines).
> 
> It would be best to split informational queries from side effects if possible.
I've changed it so that it returns a map of values rather than setting the
machine fields in place. We want the caller to set the votes of the machines
after calling this function, and it's much easier to work out that information
here, rather than have the caller try to work out the info from the replicaset
members, which may not include all the machines passed in.
Sign in to reply to this message.
rog
Please take a look.
12 years ago (2014年01月13日 17:50:35 UTC) #4
Please take a look.
Sign in to reply to this message.
natefinch
LGTM overall. I'd like to see comments on the functions even if they're not exported... ...
12 years ago (2014年01月13日 18:47:15 UTC) #5
LGTM overall. I'd like to see comments on the functions even if they're not
exported... makes it a little clearer what each one is doing.
https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired.go
File worker/peergrouper/desired.go (right):
https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired...
worker/peergrouper/desired.go:38: func desiredPeerGroup(info *peerGroupInfo)
([]replicaset.Member, map[*machine]bool, error) {
This function is pretty long, would be a little easier to read if it were broken
up more, I think.
https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired...
worker/peergrouper/desired.go:199: found = m
break here?
Sign in to reply to this message.
rog
Please take a look. https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired.go File worker/peergrouper/desired.go (right): https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired.go#newcode38 worker/peergrouper/desired.go:38: func desiredPeerGroup(info *peerGroupInfo) ([]replicaset.Member, map[*machine]bool, ...
12 years ago (2014年01月13日 19:35:20 UTC) #6
Please take a look.
https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired.go
File worker/peergrouper/desired.go (right):
https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired...
worker/peergrouper/desired.go:38: func desiredPeerGroup(info *peerGroupInfo)
([]replicaset.Member, map[*machine]bool, error) {
On 2014年01月13日 18:47:15, nate.finch wrote:
> This function is pretty long, would be a little easier to read if it were
broken
> up more, I think.
Yeah, I'd toyed with that idea but not mustered up the necessary energy.
Done; definitely a good idea, thanks.
https://codereview.appspot.com/49920045/diff/80001/worker/peergrouper/desired...
worker/peergrouper/desired.go:199: found = m
On 2014年01月13日 18:47:15, nate.finch wrote:
> break here?
Done.
Sign in to reply to this message.
natefinch
LGTM The refactor makes a big difference.
12 years ago (2014年01月13日 19:44:37 UTC) #7
LGTM The refactor makes a big difference.
Sign in to reply to this message.
rog
Please take a look.
12 years ago (2014年01月14日 09:23:08 UTC) #8
Please take a look.
Sign in to reply to this message.
|
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /