This commit is contained in:
adityatyagi821 2026-02-03 16:51:46 +00:00 committed by GitHub
commit 82a50178aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,6 +39,12 @@ import (
"github.com/prometheus/prometheus/tsdb/tombstones"
)
var warnV1Once sync.Once
func chunkDir(dir string) string {
return filepath.Join(dir, "chunks")
}
// IndexWriter serializes the index for a block of series data.
// The methods must be called in the order they are specified in.
type IndexWriter interface {
@ -254,18 +260,27 @@ const (
CompactionHintFromStaleSeries = "from-stale-series"
)
func chunkDir(dir string) string { return filepath.Join(dir, "chunks") }
func readMetaFile(dir string) (*BlockMeta, int64, error) {
b, err := os.ReadFile(filepath.Join(dir, metaFilename))
if err != nil {
return nil, 0, err
}
var m BlockMeta
var m BlockMeta
if err := json.Unmarshal(b, &m); err != nil {
return nil, 0, err
}
// ✅ Warning ONLY when V1 is used
if m.Version == metaVersion1 {
warnV1Once.Do(func() {
slog.Warn(
"TSDB V1 block format is deprecated and will be removed in a future release",
)
})
}
if m.Version != metaVersion1 {
return nil, 0, fmt.Errorf("unexpected meta file version %d", m.Version)
}