Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Try other peers for space if we get errors #1010

Merged
merged 6 commits into from
Jun 25, 2015

Conversation

bboreham
Copy link
Contributor

Replacing #1005 which was against master not 1.0

Note I have done it a slow and stupid way in one commit, then improved the algorithmic complexity using a CDF and binary search in the next commit.

Fixes #896

@rade
Copy link
Member

rade commented Jun 25, 2015

#1005 (comment) still needs addressing

@bboreham
Copy link
Contributor Author

sort.Search is a binary search.
The algorithm implemented seems to me to be the same as the one you linked to.

@rade
Copy link
Member

rade commented Jun 25, 2015

sort.Search requires the slice to be sorted. That is the case initially but not after the first iteration, since you subtract from the value of all entries in the tail.

The algorithm implemented seems to me to be the same as the one you linked to.

No, it's not. The 2nd answer says "One way to shuffle a list is to assign random numbers to each element in the list and sort by those numbers. We can extend that idea, we just have to pick weighted random numbers."

@rade
Copy link
Member

rade commented Jun 25, 2015

My bad, it's the first answer I was referring to.

@bboreham
Copy link
Contributor Author

You seem to be quoting the first answer; http://programmers.stackexchange.com/a/233552/124690. Which, as noted in the comments and at the top of the answer, gives the wrong result.

@rade
Copy link
Member

rade commented Jun 25, 2015

Which, as noted in the comments and at the top of the answer, gives the wrong result.

Hence I said "It's not perfect, but perhaps good enough?"

@bboreham
Copy link
Contributor Author

I have implemented the scheme suggested by that StackOverflow answer. It's a bit longer in Go than in Python...

@rade
Copy link
Member

rade commented Jun 25, 2015

I put some comments in bboreham@b9a069a

rade added a commit that referenced this pull request Jun 25, 2015
Try other peers for space if we get errors

Fixes #896
@rade rade merged commit 9253d45 into weaveworks:1.0 Jun 25, 2015
@rade rade added this to the 1.0.2 milestone Jun 25, 2015
@rade
Copy link
Member

rade commented Jun 25, 2015

I've merged this, but now 1.0 won't merge cleanly into master. @bboreham please do that merge and resolve the conflict.

@rade
Copy link
Member

rade commented Jun 25, 2015

now 1.0 won't merge cleanly into master

fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants