diff --git a/cmd/thanos/receive.go b/cmd/thanos/receive.go index 2ad8318fcba..4b778345450 100644 --- a/cmd/thanos/receive.go +++ b/cmd/thanos/receive.go @@ -789,7 +789,7 @@ func (rc *receiveConfig) registerFlag(cmd extkingpin.FlagClause) { rc.objStoreConfig = extkingpin.RegisterCommonObjStoreFlags(cmd, "", false) - rc.retention = extkingpin.ModelDuration(cmd.Flag("tsdb.retention", "How long to retain raw samples on local storage. 0d - disables this retention.").Default("15d")) + rc.retention = extkingpin.ModelDuration(cmd.Flag("tsdb.retention", "How long to retain raw samples on local storage. 0d - disables this retention. For more details on how retention is enforced for individual tenants, please refer to the Tenant lifecycle management section in the Receive documentation.").Default("15d")) cmd.Flag("receive.hashrings-file", "Path to file that contains the hashring configuration. A watcher is initialized to watch changes and update the hashring dynamically.").PlaceHolder("").StringVar(&rc.hashringsFilePath) diff --git a/pkg/receive/multitsdb.go b/pkg/receive/multitsdb.go index 97c8ee5007a..cbf57ebf5eb 100644 --- a/pkg/receive/multitsdb.go +++ b/pkg/receive/multitsdb.go @@ -202,6 +202,11 @@ func (t *MultiTSDB) Close() error { // Prune flushes and closes the TSDB for tenants that haven't received // any new samples for longer than the TSDB retention period. func (t *MultiTSDB) Prune(ctx context.Context) error { + // Retention of 0 means infinite retention. + if t.tsdbOpts.RetentionDuration == 0 { + return nil + } + t.mtx.Lock() defer t.mtx.Unlock()