mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Add flag to disable TSDB lock file
This commit is contained in:
parent
dae4a801cb
commit
9b175d48cb
|
@ -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.",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue