Honour PruneKeepNotReplicated.KeepSnashotAtCursor in SinglePrunerFactory

This commit is contained in:
InsanePrawn 2018-11-21 14:17:38 +01:00
parent d0f898751f
commit b79ad3ddc3

View File

@ -108,6 +108,13 @@ func NewSinglePrunerFactory(in config.PruningLocal, promPruneSecs *prometheus.Hi
return nil, errors.Wrap(err, "cannot build pruning rules") return nil, errors.Wrap(err, "cannot build pruning rules")
} }
considerSnapAtCursorReplicated := false considerSnapAtCursorReplicated := false
for _, r := range in.Keep {
knr, ok := r.Ret.(*config.PruneKeepNotReplicated)
if !ok {
continue
}
considerSnapAtCursorReplicated = considerSnapAtCursorReplicated || !knr.KeepSnapshotAtCursor
}
f := &SinglePrunerFactory{ f := &SinglePrunerFactory{
keepRules: rules, keepRules: rules,
retryWait: envconst.Duration("ZREPL_PRUNER_RETRY_INTERVAL", 10 * time.Second), retryWait: envconst.Duration("ZREPL_PRUNER_RETRY_INTERVAL", 10 * time.Second),