Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/block/indexheader/binary_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"io"
"math"
"os"
"path"
"path/filepath"
"sort"
"sync"
Expand Down Expand Up @@ -179,7 +180,10 @@ type chunkedIndexReader struct {
}

func newChunkedIndexReader(ctx context.Context, bkt objstore.BucketReader, id ulid.ULID) (*chunkedIndexReader, int, error) {
indexFilepath := filepath.Join(id.String(), block.IndexFilename)
// Use path.Join instead of filepath.Join for object storage compatibility.
// Object storage systems (S3, GCS, MinIO) require forward slashes (/) in
// object keys, but filepath.Join uses backslashes (\) on Windows.
indexFilepath := path.Join(id.String(), block.IndexFilename)
attrs, err := bkt.Attributes(ctx, indexFilepath)
if err != nil {
return nil, 0, errors.Wrapf(err, "get object attributes of %s", indexFilepath)
Expand Down
9 changes: 6 additions & 3 deletions pkg/compact/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"maps"
"math"
"path/filepath"
"path"

"github.com/go-kit/log"
"github.com/oklog/ulid/v2"
Expand Down Expand Up @@ -328,9 +328,12 @@ PlanLoop:
}
if indexSize <= 0 {
// Get size from bkt instead.
attr, err := t.bkt.Attributes(ctx, filepath.Join(p.ULID.String(), block.IndexFilename))
// Use path.Join for object storage paths to ensure Windows compatibility.
// Object storage systems require forward slashes regardless of OS.
indexPath := path.Join(p.ULID.String(), block.IndexFilename)
attr, err := t.bkt.Attributes(ctx, indexPath)
if err != nil {
return nil, errors.Wrapf(err, "get attr of %v", filepath.Join(p.ULID.String(), block.IndexFilename))
return nil, errors.Wrapf(err, "get attr of %v", indexPath)
}
indexSize = attr.Size
}
Expand Down
Loading