@@ -413,11 +413,14 @@ func (s *SupraSeal) schedule(taskFunc harmonytask.AddTaskFunc) error {
413
413
taskFunc (func (id harmonytask.TaskID , tx * harmonydb.Tx ) (shouldCommit bool , seriousError error ) {
414
414
// claim [sectors] pipeline entries
415
415
var sectors []struct {
416
- SpID int64 `db:"sp_id"`
417
- SectorNumber int64 `db:"sector_number"`
416
+ SpID int64 `db:"sp_id"`
417
+ SectorNumber int64 `db:"sector_number"`
418
+ TaskIDSDR * int64 `db:"task_id_sdr"`
418
419
}
419
420
420
- err := tx .Select (& sectors , `SELECT sp_id, sector_number FROM sectors_sdr_pipeline WHERE after_sdr = FALSE AND task_id_sdr IS NULL LIMIT $1` , s .sectors )
421
+ err := tx .Select (& sectors , `SELECT sp_id, sector_number, task_id_sdr FROM sectors_sdr_pipeline
422
+ LEFT JOIN harmony_task ht on sectors_sdr_pipeline.task_id_sdr = ht.id
423
+ WHERE after_sdr = FALSE AND (task_id_sdr IS NULL OR ht.owner_id IS NULL) LIMIT $1` , s .sectors )
421
424
if err != nil {
422
425
return false , xerrors .Errorf ("getting tasks: %w" , err )
423
426
}
@@ -436,6 +439,14 @@ func (s *SupraSeal) schedule(taskFunc harmonytask.AddTaskFunc) error {
436
439
if err != nil {
437
440
return false , xerrors .Errorf ("updating task id: %w" , err )
438
441
}
442
+
443
+ if t .TaskIDSDR != nil {
444
+ // sdr task exists, remove it from the task engine
445
+ _ , err := tx .Exec (`DELETE FROM harmony_task WHERE id = $1` , * t .TaskIDSDR )
446
+ if err != nil {
447
+ return false , xerrors .Errorf ("deleting old task: %w" , err )
448
+ }
449
+ }
439
450
}
440
451
441
452
return true , nil
@@ -447,7 +458,7 @@ func (s *SupraSeal) schedule(taskFunc harmonytask.AddTaskFunc) error {
447
458
var FSOverheadSupra = map [storiface.SectorFileType ]int { // 10x overheads
448
459
storiface .FTUnsealed : storiface .FSOverheadDen ,
449
460
storiface .FTSealed : storiface .FSOverheadDen ,
450
- storiface .FTCache : 11 , // C + R' (no 11 layers + D(2x ssize)); Has 'sealed-file' here briefly, but that is moved to the real sealed file quickly
461
+ storiface .FTCache : 11 , // C + R' (no 11 layers + D(2x ssize));
451
462
}
452
463
453
464
func SupraSpaceUse (ft storiface.SectorFileType , ssize abi.SectorSize ) (uint64 , error ) {
0 commit comments