Merge pull request #11532 from filecoin-project/fix/lpwinning-nowin-err
lpwinning: Don't say a task is done when persistNoWin fails
This commit is contained in:
commit
a959c049b3
@ -184,6 +184,9 @@ retryRecordCompletion:
|
|||||||
return false, fmt.Errorf("could not log completion: %w", err)
|
return false, fmt.Errorf("could not log completion: %w", err)
|
||||||
}
|
}
|
||||||
result = ""
|
result = ""
|
||||||
|
if doErr != nil {
|
||||||
|
result = "non-failing error: " + doErr.Error()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if doErr != nil {
|
if doErr != nil {
|
||||||
result = "error: " + doErr.Error()
|
result = "error: " + doErr.Error()
|
||||||
|
@ -156,13 +156,18 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
|
|||||||
ComputeTime: details.CompTime,
|
ComputeTime: details.CompTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
persistNoWin := func() error {
|
persistNoWin := func() (bool, error) {
|
||||||
_, err := t.db.Exec(ctx, `UPDATE mining_base_block SET no_win = true WHERE task_id = $1`, taskID)
|
n, err := t.db.Exec(ctx, `UPDATE mining_base_block SET no_win = true WHERE task_id = $1`, taskID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("marking base as not-won: %w", err)
|
return false, xerrors.Errorf("marking base as not-won: %w", err)
|
||||||
|
}
|
||||||
|
log.Debugw("persisted no-win", "rows", n)
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
return false, xerrors.Errorf("persist no win: no rows updated")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure we have a beacon entry for the epoch we're mining on
|
// ensure we have a beacon entry for the epoch we're mining on
|
||||||
@ -182,13 +187,13 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
|
|||||||
if mbi == nil {
|
if mbi == nil {
|
||||||
// not eligible to mine on this base, we're done here
|
// not eligible to mine on this base, we're done here
|
||||||
log.Debugw("WinPoSt not eligible to mine on this base", "tipset", types.LogCids(base.TipSet.Cids()))
|
log.Debugw("WinPoSt not eligible to mine on this base", "tipset", types.LogCids(base.TipSet.Cids()))
|
||||||
return true, persistNoWin()
|
return persistNoWin()
|
||||||
}
|
}
|
||||||
|
|
||||||
if !mbi.EligibleForMining {
|
if !mbi.EligibleForMining {
|
||||||
// slashed or just have no power yet, we're done here
|
// slashed or just have no power yet, we're done here
|
||||||
log.Debugw("WinPoSt not eligible for mining", "tipset", types.LogCids(base.TipSet.Cids()))
|
log.Debugw("WinPoSt not eligible for mining", "tipset", types.LogCids(base.TipSet.Cids()))
|
||||||
return true, persistNoWin()
|
return persistNoWin()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(mbi.Sectors) == 0 {
|
if len(mbi.Sectors) == 0 {
|
||||||
@ -217,7 +222,7 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
|
|||||||
if eproof == nil {
|
if eproof == nil {
|
||||||
// not a winner, we're done here
|
// not a winner, we're done here
|
||||||
log.Debugw("WinPoSt not a winner", "tipset", types.LogCids(base.TipSet.Cids()))
|
log.Debugw("WinPoSt not a winner", "tipset", types.LogCids(base.TipSet.Cids()))
|
||||||
return true, persistNoWin()
|
return persistNoWin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user