Merge pull request #2345 from weaveworks/issues/2344-persist-more

Fix ring persistence after free space update
This commit is contained in:
Adam Harrison committed 2016-06-09 16:37:57 +01:00
commit adcb1018df
2 files changed
+8 -4

No files matched your search

+5 -3
View File
@@ -449,8 +449,8 @@ func (r *Ring) String() string {
// ReportFree is used by the allocator to tell the ring how many free
// ips are in a given range, so that ChoosePeersToAskForSpace can make
// more intelligent decisions.
func (r *Ring) ReportFree(freespace map[address.Address]address.Count) {
// more intelligent decisions. Returns true if any changes made.
func (r *Ring) ReportFree(freespace map[address.Address]address.Count) (updated bool) {
r.assertInvariants()
defer r.assertInvariants()
defer r.updateExportedVariables()
@@ -483,12 +483,14 @@ func (r *Ring) ReportFree(freespace map[address.Address]address.Count) {
common.Assert(free <= address.Count(maxSize))
if entries[i].Free == free {
return
continue
}
entries[i].Free = free
entries[i].Version++
updated = true
}
return
}
type weightedPeer struct {