Skip to content

Commit 676c024

Browse files
committed
explicit format handling
1 parent 42138cd commit 676c024

File tree

10 files changed

+183
-123
lines changed

10 files changed

+183
-123
lines changed

api/gen/proto/go/metastore/v1/types.pb.go

+51-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/gen/proto/go/metastore/v1/types_vtproto.pb.go

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/metastore/v1/types.proto

+8-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ message BlockMeta {
3535
}
3636

3737
message Dataset {
38+
uint32 format = 9;
39+
3840
int32 tenant = 1;
3941
int32 name = 2;
4042
int64 min_time = 3;
@@ -44,10 +46,15 @@ message Dataset {
4446
// service region. The offsets are absolute.
4547
//
4648
// The interpretation of the table of contents is specific
47-
// to the metadata format version. By default, the sections are:
49+
// to the format.
50+
//
51+
// By default (format 0), the sections are:
4852
// - 0: profiles.parquet
4953
// - 1: index.tsdb
5054
// - 2: symbols.symdb
55+
//
56+
// Format 1 corresponds to the tenant-wide index:
57+
// - 0: index.tsdb (dataset index)
5158
repeated uint64 table_of_contents = 5;
5259

5360
// Size of the dataset in bytes.

api/openapiv2/gen/phlare.swagger.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,10 @@
842842
"v1Dataset": {
843843
"type": "object",
844844
"properties": {
845+
"format": {
846+
"type": "integer",
847+
"format": "int64"
848+
},
845849
"tenant": {
846850
"type": "integer",
847851
"format": "int32"
@@ -864,7 +868,7 @@
864868
"type": "string",
865869
"format": "uint64"
866870
},
867-
"description": "Table of contents lists data sections within the tenant\nservice region. The offsets are absolute.\n\nThe interpretation of the table of contents is specific\nto the metadata format version. By default, the sections are:\n - 0: profiles.parquet\n - 1: index.tsdb\n - 2: symbols.symdb"
871+
"description": "Table of contents lists data sections within the tenant\nservice region. The offsets are absolute.\n\nThe interpretation of the table of contents is specific\nto the format.\n\nBy default (format 0), the sections are:\n - 0: profiles.parquet\n - 1: index.tsdb\n - 2: symbols.symdb\n\nFormat 1 corresponds to the tenant-wide index:\n - 0: index.tsdb (dataset index)"
868872
},
869873
"size": {
870874
"type": "string",

pkg/experiment/block/compaction.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,15 @@ func (b *CompactionPlan) writeDatasetIndex(w *Writer) error {
222222
if err != nil {
223223
return err
224224
}
225+
// We annotate the dataset with the
226+
// __tenant_dataset__ = "dataset_tsdb_index" label,
227+
// so the dataset index metadata can be queried.
225228
labels := metadata.NewLabelBuilder(b.strings).BuildPairs(
226229
metadata.LabelNameTenantDataset,
227230
metadata.LabelValueDatasetTSDBIndex,
228231
)
229232
b.meta.Datasets = append(b.meta.Datasets, &metastorev1.Dataset{
233+
Format: 1,
230234
Tenant: b.meta.Tenant,
231235
Name: 0, // Anonymous.
232236
MinTime: b.meta.MinTime,
@@ -352,7 +356,11 @@ func (m *datasetCompaction) open(ctx context.Context, path string) (err error) {
352356
for _, s := range m.datasets {
353357
s := s
354358
g.Go(util.RecoverPanic(func() error {
355-
if openErr := s.Open(ctx, allSections...); openErr != nil {
359+
if openErr := s.Open(ctx,
360+
SectionProfiles,
361+
SectionTSDB,
362+
SectionSymbols,
363+
); openErr != nil {
356364
return fmt.Errorf("opening tenant dataset (block %s): %w", s.obj.path, openErr)
357365
}
358366
return nil

0 commit comments

Comments
 (0)