Skip to content

fix(parquet store gateways): correctly locate labels parquet files locally #11894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
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
18 changes: 17 additions & 1 deletion pkg/storage/parquet/block/lazy_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,29 @@ func (r *LazyReaderLocalLabelsBucketChunks) downloadLabelsFileToLocalDisk() erro

func (r *LazyReaderLocalLabelsBucketChunks) LabelsFile() *storage.ParquetFile {
loaded := r.getOrLoadReader(r.ctx)
if loaded.err != nil {
// TODO: the current interface does not allow to return an error
level.Error(r.logger).Log("msg", "failed to get labels file from lazy reader", "err", loaded.err)
return nil
}
return loaded.reader.LabelsFile()
}

func (r *LazyReaderLocalLabelsBucketChunks) ChunksFile() *storage.ParquetFile {
loaded := r.getOrLoadReader(r.ctx)
if loaded.err != nil {
// TODO: the current interface does not allow to return an error
level.Error(r.logger).Log("msg", "failed to get chunks file from lazy reader", "err", loaded.err)
return nil
}
return loaded.reader.ChunksFile()
}

func (r *LazyReaderLocalLabelsBucketChunks) TSDBSchema() (*schema.TSDBSchema, error) {
loaded := r.getOrLoadReader(r.ctx)
if loaded.err != nil {
return nil, errors.Wrap(loaded.err, "get TSDB schema from lazy reader")
}
return loaded.reader.TSDBSchema()
}

Expand Down Expand Up @@ -332,7 +345,10 @@ func (r *LazyReaderLocalLabelsBucketChunks) loadReader() (Reader, error) {
startTime := time.Now()

labelsLocalFilePath := r.labelsFileLocalPath()
labelsLocalFileOpener := NewParquetLocalFileOpener(r.localDir)
// The BasicReader appends the block ID to the local directory, so we need to trim it here.
// TODO: we should rethink the namings conventions to locate the files to avoid these hacks.
localDir := strings.TrimSuffix(r.localDir, r.blockID.String())
labelsLocalFileOpener := NewParquetLocalFileOpener(localDir)
chunksBucketOpener := storage.NewParquetBucketOpener(r.bkt)

reader, err := NewBasicReader(
Expand Down
Loading