From 9bb7b19c930287ecf29f730acb7c10c75c1e7ec9 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 12 Oct 2018 15:29:07 +0200 Subject: [PATCH] pruner: handle replication cursor being older than any snapshot correctly --- daemon/pruner/pruner.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/daemon/pruner/pruner.go b/daemon/pruner/pruner.go index ebdfe1c..c2f3382 100644 --- a/daemon/pruner/pruner.go +++ b/daemon/pruner/pruner.go @@ -402,7 +402,17 @@ fsloop: sort.Slice(tfsvs, func(i, j int) bool { return tfsvs[i].CreateTXG < tfsvs[j].CreateTXG }) - preCursor := true + + haveCursorSnapshot := false + for _, tfsv := range tfsvs { + if tfsv.Type != pdu.FilesystemVersion_Snapshot { + continue + } + if tfsv.Guid == rc.GetGuid() { + haveCursorSnapshot = true + } + } + preCursor := haveCursorSnapshot for _, tfsv := range tfsvs { if tfsv.Type != pdu.FilesystemVersion_Snapshot { continue @@ -413,6 +423,7 @@ fsloop: l.WithError(pfs.err).Error("") continue fsloop } + // note that we cannot use CreateTXG because target and receiver could be on different pools atCursor := tfsv.Guid == rc.GetGuid() preCursor = preCursor && !atCursor pfs.snaps = append(pfs.snaps, snapshot{