diff --git a/block.go b/block.go index 7c5ec2cca..35b5e1828 100644 --- a/block.go +++ b/block.go @@ -101,11 +101,11 @@ func (pb *persistedBlock) interval() (int64, int64) { } func chunksFileName(path string) string { - return filepath.Join(path, "000-series") + return filepath.Join(path, "chunks-000") } func indexFileName(path string) string { - return filepath.Join(path, "000-index") + return filepath.Join(path, "index-000") } type mmapFile struct { diff --git a/db.go b/db.go index e0ed8e804..9877205fa 100644 --- a/db.go +++ b/db.go @@ -10,6 +10,7 @@ import ( "path/filepath" "reflect" "strconv" + "strings" "sync" "unsafe" @@ -216,7 +217,10 @@ func isBlockDir(fi os.FileInfo) bool { if !fi.IsDir() { return false } - if _, err := strconv.ParseUint(fi.Name(), 10, 32); err != nil { + if !strings.HasPrefix(fi.Name(), "b-") { + return false + } + if _, err := strconv.ParseUint(fi.Name()[2:], 10, 32); err != nil { return false } return true @@ -475,13 +479,19 @@ func (p *DB) nextBlockDir() (string, error) { if err != nil { return "", err } + i := uint64(0) - if len(names) > 0 { - if i, err = strconv.ParseUint(names[len(names)-1], 10, 32); err != nil { - return "", err + for _, n := range names { + if !strings.HasPrefix(n, "b-") { + continue + } + j, err := strconv.ParseUint(n[2:], 10, 32) + if err != nil { + continue } + i = j } - return filepath.Join(p.dir, fmt.Sprintf("%0.6d", i+1)), nil + return filepath.Join(p.dir, fmt.Sprintf("b-%0.6d", i+1)), nil } // chunkDesc wraps a plain data chunk and provides cached meta data about it. diff --git a/wal.go b/wal.go index efd6ade9c..796fbad1c 100644 --- a/wal.go +++ b/wal.go @@ -33,7 +33,7 @@ type WAL struct { symbols map[string]uint32 } -const walFileName = "000-wal" +const walFileName = "wal-000" // OpenWAL opens or creates a write ahead log in the given directory. // The WAL must be read completely before new data is written.