sched: Fix panic in workerCompactWindows
This commit is contained in:
parent
9a3b2abbab
commit
28ac2fce61
2
extern/sector-storage/sched.go
vendored
2
extern/sector-storage/sched.go
vendored
@ -641,7 +641,7 @@ func (sh *scheduler) workerCompactWindows(worker *workerHandle, wid WorkerID) in
|
|||||||
if len(moved) > 0 {
|
if len(moved) > 0 {
|
||||||
newTodo := make([]*workerRequest, 0, len(window.todo)-len(moved))
|
newTodo := make([]*workerRequest, 0, len(window.todo)-len(moved))
|
||||||
for i, t := range window.todo {
|
for i, t := range window.todo {
|
||||||
if moved[0] == i {
|
if len(moved) > 0 && moved[0] == i {
|
||||||
moved = moved[1:]
|
moved = moved[1:]
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
5
extern/sector-storage/sched_test.go
vendored
5
extern/sector-storage/sched_test.go
vendored
@ -637,4 +637,9 @@ func TestWindowCompact(t *testing.T) {
|
|||||||
[][]sealtasks.TaskType{{sealtasks.TTPreCommit1, sealtasks.TTPreCommit1}, {sealtasks.TTPreCommit1, sealtasks.TTAddPiece}},
|
[][]sealtasks.TaskType{{sealtasks.TTPreCommit1, sealtasks.TTPreCommit1}, {sealtasks.TTPreCommit1, sealtasks.TTAddPiece}},
|
||||||
[][]sealtasks.TaskType{{sealtasks.TTPreCommit1, sealtasks.TTPreCommit1, sealtasks.TTAddPiece}, {sealtasks.TTPreCommit1}}),
|
[][]sealtasks.TaskType{{sealtasks.TTPreCommit1, sealtasks.TTPreCommit1, sealtasks.TTAddPiece}, {sealtasks.TTPreCommit1}}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
t.Run("2pc1-pc1appc2", test(
|
||||||
|
[][]sealtasks.TaskType{{sealtasks.TTPreCommit1, sealtasks.TTPreCommit1}, {sealtasks.TTPreCommit1, sealtasks.TTAddPiece, sealtasks.TTPreCommit2}},
|
||||||
|
[][]sealtasks.TaskType{{sealtasks.TTPreCommit1, sealtasks.TTPreCommit1, sealtasks.TTAddPiece}, {sealtasks.TTPreCommit1, sealtasks.TTPreCommit2}}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user