From 9b175d48cb73a3821dac8c192171470996228b5c Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 9 May 2017 12:56:51 +0200 Subject: [PATCH] Add flag to disable TSDB lock file --- cmd/prometheus/config.go | 4 ++++ storage/tsdb/tsdb.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cmd/prometheus/config.go b/cmd/prometheus/config.go index 0edaa1f9d..a7986b99c 100644 --- a/cmd/prometheus/config.go +++ b/cmd/prometheus/config.go @@ -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.", diff --git a/storage/tsdb/tsdb.go b/storage/tsdb/tsdb.go index f3736c444..a2c869f60 100644 --- a/storage/tsdb/tsdb.go +++ b/storage/tsdb/tsdb.go @@ -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