mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
tsdb: simplify code. (#7792)
Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
parent
362080ba28
commit
b521612042
|
@ -572,8 +572,11 @@ func open(dir string, l log.Logger, r prometheus.Registerer, opts *Options, rngs
|
||||||
if err := repairBadIndexVersion(l, dir); err != nil {
|
if err := repairBadIndexVersion(l, dir); err != nil {
|
||||||
return nil, errors.Wrap(err, "repair bad index version")
|
return nil, errors.Wrap(err, "repair bad index version")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
walDir := filepath.Join(dir, "wal")
|
||||||
|
|
||||||
// Migrate old WAL if one exists.
|
// Migrate old WAL if one exists.
|
||||||
if err := MigrateWAL(l, filepath.Join(dir, "wal")); err != nil {
|
if err := MigrateWAL(l, walDir); err != nil {
|
||||||
return nil, errors.Wrap(err, "migrate WAL")
|
return nil, errors.Wrap(err, "migrate WAL")
|
||||||
}
|
}
|
||||||
// Remove garbage, tmp blocks.
|
// Remove garbage, tmp blocks.
|
||||||
|
@ -618,7 +621,6 @@ func open(dir string, l log.Logger, r prometheus.Registerer, opts *Options, rngs
|
||||||
|
|
||||||
var wlog *wal.WAL
|
var wlog *wal.WAL
|
||||||
segmentSize := wal.DefaultSegmentSize
|
segmentSize := wal.DefaultSegmentSize
|
||||||
walDir := filepath.Join(dir, "wal")
|
|
||||||
// Wal is enabled.
|
// Wal is enabled.
|
||||||
if opts.WALSegmentSize >= 0 {
|
if opts.WALSegmentSize >= 0 {
|
||||||
// Wal is set to a custom size.
|
// Wal is set to a custom size.
|
||||||
|
|
Loading…
Reference in a new issue