Add flag to disable TSDB lock file

This commit is contained in:
Fabian Reinartz 2017-05-09 12:56:51 +02:00
parent dae4a801cb
commit 9b175d48cb
2 changed files with 8 additions and 0 deletions

View file

@ -125,6 +125,10 @@ func init() {
&cfg.localStoragePath, "storage.local.path", "data",
"Base path for metrics storage.",
)
cfg.fs.BoolVar(
&cfg.tsdb.NoLockfile, "storage.tsdb.no-lockfile", false,
"Disable lock file usage.",
)
cfg.fs.DurationVar(
&cfg.tsdb.MinBlockDuration, "storage.tsdb.min-block-duration", 2*time.Hour,
"Minimum duration of a data block before being persisted.",

View file

@ -50,6 +50,9 @@ type Options struct {
// Duration for how long to retain data.
Retention time.Duration
// Disable creation and consideration of lockfile.
NoLockfile bool
}
// Open returns a new storage backed by a tsdb database.
@ -60,6 +63,7 @@ func Open(path string, r prometheus.Registerer, opts *Options) (storage.Storage,
MaxBlockDuration: uint64(opts.MaxBlockDuration.Seconds() * 1000),
AppendableBlocks: opts.AppendableBlocks,
RetentionDuration: uint64(opts.Retention.Seconds() * 1000),
NoLockfile: opts.NoLockfile,
})
if err != nil {
return nil, err