diff --git a/client/client.go b/client/client.go index f16a29562ab..f99c2f330ac 100644 --- a/client/client.go +++ b/client/client.go @@ -1767,6 +1767,9 @@ func (c *Client) allocSync() { // allocUpdates holds the results of receiving updated allocations from the // servers. type allocUpdates struct { + // index is index of server store snapshot used for fetching alloc status + index uint64 + // pulled is the set of allocations that were downloaded from the servers. pulled map[string]*structs.Allocation @@ -1944,6 +1947,7 @@ OUTER: filtered: filtered, pulled: pulledAllocs, migrateTokens: resp.MigrateTokens, + index: resp.Index, } select { diff --git a/client/util.go b/client/util.go index af3bd75400b..b8690f647c6 100644 --- a/client/util.go +++ b/client/util.go @@ -33,7 +33,7 @@ func diffAllocs(existing map[string]uint64, allocs *allocUpdates) *diffResult { _, filtered := allocs.filtered[existID] // If not updated or filtered, removed - if !pulled && !filtered { + if !pulled && !filtered && allocs.index > existIndex { result.removed = append(result.removed, existID) continue }