pruning/history: properly communicate via rpc if snapshot does not exist

This commit is contained in:
Christian Schwarz
2018-09-04 13:29:51 -07:00
parent 8799108b55
commit 0c4a3f8dc4
5 changed files with 128 additions and 79 deletions
+10 -2
View File
@@ -279,6 +279,11 @@ func statePlan(a *args, u updater) state {
Op: pdu.SnapshotReplicationStatusReq_Get,
}
res, err := receiver.SnapshotReplicationStatus(ctx, &req)
if err != nil {
GetLogger(ctx).
WithField("req", req.String()).
WithError(err).Error("cannot get snapshot replication status")
}
if err != nil && shouldRetry(err) {
return onErr(u, err)
} else if err != nil {
@@ -286,9 +291,12 @@ func statePlan(a *args, u updater) state {
pfs.snaps = nil
break
}
if res.Status == pdu.SnapshotReplicationStatusRes_Nonexistent {
GetLogger(ctx).
Debug("snapshot does not exist in history, assuming was replicated")
}
pfs.snaps = append(pfs.snaps, snapshot{
replicated: res.Replicated,
replicated: !(res.Status != pdu.SnapshotReplicationStatusRes_Replicated),
date: creation,
fsv: tfsv,
})