tsdb: simplify code. (#7792)

Signed-off-by: johncming <johncming@yahoo.com>
pull/7807/head
johncming 4 years ago committed by GitHub
parent 362080ba28
commit b521612042
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -572,8 +572,11 @@ func open(dir string, l log.Logger, r prometheus.Registerer, opts *Options, rngs
if err := repairBadIndexVersion(l, dir); err != nil {
return nil, errors.Wrap(err, "repair bad index version")
}
walDir := filepath.Join(dir, "wal")
// 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")
}
// 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
segmentSize := wal.DefaultSegmentSize
walDir := filepath.Join(dir, "wal")
// Wal is enabled.
if opts.WALSegmentSize >= 0 {
// Wal is set to a custom size.

Loading…
Cancel
Save