mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -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",
|
&cfg.localStoragePath, "storage.local.path", "data",
|
||||||
"Base path for metrics storage.",
|
"Base path for metrics storage.",
|
||||||
)
|
)
|
||||||
|
cfg.fs.BoolVar(
|
||||||
|
&cfg.tsdb.NoLockfile, "storage.tsdb.no-lockfile", false,
|
||||||
|
"Disable lock file usage.",
|
||||||
|
)
|
||||||
cfg.fs.DurationVar(
|
cfg.fs.DurationVar(
|
||||||
&cfg.tsdb.MinBlockDuration, "storage.tsdb.min-block-duration", 2*time.Hour,
|
&cfg.tsdb.MinBlockDuration, "storage.tsdb.min-block-duration", 2*time.Hour,
|
||||||
"Minimum duration of a data block before being persisted.",
|
"Minimum duration of a data block before being persisted.",
|
||||||
|
|
|
@ -50,6 +50,9 @@ type Options struct {
|
||||||
|
|
||||||
// Duration for how long to retain data.
|
// Duration for how long to retain data.
|
||||||
Retention time.Duration
|
Retention time.Duration
|
||||||
|
|
||||||
|
// Disable creation and consideration of lockfile.
|
||||||
|
NoLockfile bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open returns a new storage backed by a tsdb database.
|
// 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),
|
MaxBlockDuration: uint64(opts.MaxBlockDuration.Seconds() * 1000),
|
||||||
AppendableBlocks: opts.AppendableBlocks,
|
AppendableBlocks: opts.AppendableBlocks,
|
||||||
RetentionDuration: uint64(opts.Retention.Seconds() * 1000),
|
RetentionDuration: uint64(opts.Retention.Seconds() * 1000),
|
||||||
|
NoLockfile: opts.NoLockfile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue