make rmpeer report on size of transferred space, and not fail

Closes #2058.
This commit is contained in:
Matthias Radestock committed 2016-03-19 14:40:26 +00:00
1 parent c48eefa82d
commit 62d823850c
5 files changed
+34 -27

No files matched your search

+2 -8
View File
@@ -498,28 +498,22 @@ func (r *Ring) PickPeerForTransfer(isValid func(mesh.PeerName) bool) mesh.PeerNa
// Transfer will mark all entries associated with 'from' peer as owned by 'to' peer
// and return ranges indicating the new space we picked up
func (r *Ring) Transfer(from, to mesh.PeerName) ([]address.Range, error) {
func (r *Ring) Transfer(from, to mesh.PeerName) []address.Range {
r.assertInvariants()
defer r.assertInvariants()
defer r.updateExportedVariables()
var newRanges []address.Range
found := false
for i, entry := range r.Entries {
if entry.Peer == from {
found = true
entry.Peer = to
entry.Version++
newRanges = append(newRanges, address.Range{Start: entry.Token, End: r.Entries.entry(i + 1).Token})
}
}
if !found {
return nil, ErrNotFound
}
return r.splitRangesOverZero(newRanges), nil
return r.splitRangesOverZero(newRanges)
}
// Contains returns true if addr is in this ring