mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Merge pull request #12349 from rfratto/fix-wlog-path
wlog: use filepath for getting checkpoint number 'path' is intended for things like URLs that are forward-slash-only. 'filepath' is for file paths, as used here.
This commit is contained in:
commit
fa4f4e4f37
|
@ -18,7 +18,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -156,7 +156,7 @@ func NewWatcher(metrics *WatcherMetrics, readerMetrics *LiveReaderMetrics, logge
|
||||||
writer: writer,
|
writer: writer,
|
||||||
metrics: metrics,
|
metrics: metrics,
|
||||||
readerMetrics: readerMetrics,
|
readerMetrics: readerMetrics,
|
||||||
walDir: path.Join(dir, "wal"),
|
walDir: filepath.Join(dir, "wal"),
|
||||||
name: name,
|
name: name,
|
||||||
sendExemplars: sendExemplars,
|
sendExemplars: sendExemplars,
|
||||||
sendHistograms: sendHistograms,
|
sendHistograms: sendHistograms,
|
||||||
|
@ -691,7 +691,7 @@ func (w *Watcher) readCheckpoint(checkpointDir string, readFn segmentReadFn) err
|
||||||
func checkpointNum(dir string) (int, error) {
|
func checkpointNum(dir string) (int, error) {
|
||||||
// Checkpoint dir names are in the format checkpoint.000001
|
// Checkpoint dir names are in the format checkpoint.000001
|
||||||
// dir may contain a hidden directory, so only check the base directory
|
// dir may contain a hidden directory, so only check the base directory
|
||||||
chunks := strings.Split(path.Base(dir), ".")
|
chunks := strings.Split(filepath.Base(dir), ".")
|
||||||
if len(chunks) != 2 {
|
if len(chunks) != 2 {
|
||||||
return 0, errors.Errorf("invalid checkpoint dir string: %s", dir)
|
return 0, errors.Errorf("invalid checkpoint dir string: %s", dir)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue