Skip to content

Commit 0234998

Browse files
committed
feat(v2): evict failed jobs from compaction scheduler queue
1 parent 1a57c65 commit 0234998

File tree

12 files changed

+712
-169
lines changed

12 files changed

+712
-169
lines changed

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

Lines changed: 212 additions & 133 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/gen/proto/go/metastore/v1/raft_log/raft_log_vtproto.pb.go

Lines changed: 256 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/metastore/v1/raft_log/raft_log.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ message CompactionPlanUpdate {
4646
repeated AssignedCompactionJob assigned_jobs = 2;
4747
repeated UpdatedCompactionJob updated_jobs = 3;
4848
repeated CompletedCompactionJob completed_jobs = 4;
49+
repeated EvictedCompactionJob evicted_jobs = 5;
4950
}
5051

5152
message NewCompactionJob {
@@ -67,6 +68,10 @@ message CompletedCompactionJob {
6768
metastore.v1.CompactedBlocks compacted_blocks = 2;
6869
}
6970

71+
message EvictedCompactionJob {
72+
CompactionJobState state = 1;
73+
}
74+
7075
// CompactionJobState is produced in response to
7176
// the compaction worker status update request.
7277
//

pkg/experiment/metastore/compaction/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,14 @@ reports from workers, as jobs that cause workers to crash would yield no reports
259259

260260
To avoid infinite reassignment loops, the scheduler keeps track of reassignments (failures) for each job. If the number
261261
of failures exceeds a set threshold, the job is not reassigned and remains at the bottom of the queue. Once the cause of
262-
failure is resolved, the limit can be temporarily increased to reprocess these jobs.
262+
failure is resolved, the error limit can be temporarily increased to reprocess these jobs.
263+
264+
The scheduler queue has a size limit. Typically, the only scenario in which this limit is reached is when the compaction
265+
process is not functioning correctly (e.g., due to a bug in the compaction procedure), preventing blocks from being
266+
compacted and resulting in many jobs remaining in a failed state. Once the queue size limit is reached, failed jobs are
267+
evicted, meaning the corresponding blocks will never be compacted. This may cause read amplification of the data queries
268+
and bloat the metadata index. Therefore, the limit should be large enough. The recommended course of action is to roll
269+
back or fix the bug and restart the compaction process, temporarily increasing the error limit if necessary.
263270

264271
### Job Completion
265272

pkg/experiment/metastore/compaction/compaction.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ type Schedule interface {
5555
UpdateJob(*raft_log.CompactionJobStatusUpdate) *raft_log.CompactionJobState
5656
// AssignJob is called on behalf of the worker to request a new job.
5757
AssignJob() (*raft_log.AssignedCompactionJob, error)
58+
// EvictJob is called on behalf of the planner to evict jobs that cannot
59+
// be assigned to workers, and free up resources for new jobs.
60+
EvictJob() *raft_log.CompactionJobState
5861
// AddJob is called on behalf of the planner to add a new job to the schedule.
5962
// The scheduler may decline the job by returning a nil state.
6063
AddJob(*raft_log.CompactionJobPlan) *raft_log.CompactionJobState

0 commit comments

Comments
 (0)