From 873781ab580773c17c573383bd77fd709207a3e6 Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Fri, 26 Apr 2019 15:15:47 +0530 Subject: [PATCH] bump up the version of entry by large value so that transfer of range takes precedence (if there is any conflict in merging entry) over other operations on the entry that increments the version Fixes #3612 --- ipam/ring/ring.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipam/ring/ring.go b/ipam/ring/ring.go index 3cd45099..55e139f8 100644 --- a/ipam/ring/ring.go +++ b/ipam/ring/ring.go @@ -565,7 +565,9 @@ func (r *Ring) Transfer(from, to mesh.PeerName) []address.Range { for i, entry := range r.Entries { if entry.Peer == from { entry.Peer = to - entry.Version++ + // bump version by large value so that transfer of range takes precedence (if there is any conflict in merging entry) + // over other opertaions on the entry that increments the version + entry.Version = entry.Version + 100 newRanges = append(newRanges, address.Range{Start: entry.Token, End: r.Entries.entry(i + 1).Token}) } }