Skip to content

Commit

Permalink
schedule planning
Browse files Browse the repository at this point in the history
  • Loading branch information
kolesnikovae committed Nov 5, 2024
1 parent 6230b1b commit 933b881
Show file tree
Hide file tree
Showing 19 changed files with 993 additions and 820 deletions.
250 changes: 183 additions & 67 deletions api/gen/proto/go/metastore/v1/raft_log/raft_log.pb.go

Large diffs are not rendered by default.

459 changes: 428 additions & 31 deletions api/gen/proto/go/metastore/v1/raft_log/raft_log_vtproto.pb.go

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions api/metastore/v1/raft_log/raft_log.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,25 @@ message CompactionPlanUpdate {
message CompactionJobState {
string name = 1;
uint32 compaction_level = 2;

metastore.v1.CompactionJobStatus status = 3;

uint64 raft_log_index = 4;
int64 lease_expires_at = 5;
int64 failures = 6;
int64 added_at = 7;

// Only present if the status is SUCCESS.
repeated metastore.v1.BlockMeta compacted_blocks = 8;
repeated string deleted_blocks = 9;
CompactedBlocks compacted_blocks = 8;
}

message CompactedBlocks {
string job_name = 1;
string tenant = 2;
uint32 shard = 3;
uint32 compaction_level = 4;
repeated string source_blocks = 5;
repeated metastore.v1.BlockMeta compacted_blocks = 6;
repeated string deleted_blocks = 7;
}

// UpdateCompactionPlanRequest proposes compaction plan changes.
Expand Down
18 changes: 5 additions & 13 deletions pkg/experiment/metastore/compaction/compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,23 @@ import (

type Planner interface {
AddBlocks(*bbolt.Tx, *raft.Log, ...*metastorev1.BlockMeta) error
Planned(*bbolt.Tx, *metastorev1.CompactionJob) error
Compacted(*bbolt.Tx, CompactedBlocks) error
NewPlan(*bbolt.Tx) Plan
// Planned and Compacted methods is the way Scheduler communicates to planner.
Planned(*bbolt.Tx, *metastorev1.CompactionJob) error
Compacted(*bbolt.Tx, *raft_log.CompactedBlocks) error
}

type Plan interface {
CreateJob() *metastorev1.CompactionJob
}

type Scheduler interface {
AddJobs(*bbolt.Tx, ...*metastorev1.CompactionJob) error
UpdateSchedule(*bbolt.Tx, ...*raft_log.CompactionJobState) error
AddJobs(*bbolt.Tx, Planner, ...*metastorev1.CompactionJob) error
UpdateSchedule(*bbolt.Tx, Planner, ...*raft_log.CompactionJobState) error
NewSchedule(*bbolt.Tx, *raft.Log) Schedule
}

type Schedule interface {
UpdateJob(*metastorev1.CompactionJobStatusUpdate) *raft_log.CompactionJobState
AssignJob() (*metastorev1.CompactionJob, *raft_log.CompactionJobState)
}

type CompactedBlocks struct {
Tenant string
Shard uint32
Level uint32
Source []string
Deleted []string
Blocks []*metastorev1.BlockMeta
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 933b881

Please sign in to comment.