v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
3 changed files with 19 additions and 7 deletions
Showing only changes of commit 04f5a595e4 - Show all commits

View File

@ -67,8 +67,8 @@ create table sectors_sdr_pipeline (
-- Failure handling -- Failure handling
failed bool not null default false, failed bool not null default false,
failed_at timestamp, failed_at timestamp,
failed_reason varchar(20), failed_reason varchar(20) not null default '',
failed_reason_msg text, failed_reason_msg text not null default '',
-- constraints -- constraints
primary key (sp_id, sector_number) primary key (sp_id, sector_number)

View File

@ -42,7 +42,7 @@ func (s *SealPoller) RunPoller(ctx context.Context) {
return return
case <-ticker.C: case <-ticker.C:
if err := s.poll(ctx); err != nil { if err := s.poll(ctx); err != nil {
log.Errorf("polling sdr sector pipeline: %w", err) log.Errorw("polling failed", "error", err)
} }
} }
} }
@ -84,7 +84,19 @@ func (s *SealPoller) poll(ctx context.Context) error {
FailedReason string `db:"failed_reason"` FailedReason string `db:"failed_reason"`
} }
err := s.db.Select(ctx, &tasks, `SELECT * FROM sectors_sdr_pipeline WHERE after_commit_msg_success != true`) err := s.db.Select(ctx, &tasks, `SELECT
sp_id, sector_number,
task_id_sdr, after_sdr,
task_id_tree_d, after_tree_d,
task_id_tree_c, after_tree_c,
task_id_tree_r, after_tree_r,
task_id_precommit_msg, after_precommit_msg,
task_id_precommit_msg_wait, after_precommit_msg_success,
task_id_porep, porep_proof,
task_id_commit_msg, after_commit_msg,
task_id_commit_msg_wait, after_commit_msg_success,
failed, failed_reason
FROM sectors_sdr_pipeline WHERE after_commit_msg_success != true`)
if err != nil { if err != nil {
return err return err
} }

View File

@ -107,13 +107,13 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
// First query to fetch from mining_tasks // First query to fetch from mining_tasks
err = t.db.QueryRow(ctx, `SELECT sp_id, epoch, base_compute_time FROM mining_tasks WHERE task_id = $1`, taskID).Scan(&details.SpID, &details.Epoch, &details.CompTime) err = t.db.QueryRow(ctx, `SELECT sp_id, epoch, base_compute_time FROM mining_tasks WHERE task_id = $1`, taskID).Scan(&details.SpID, &details.Epoch, &details.CompTime)
if err != nil { if err != nil {
return false, err return false, xerrors.Errorf("query mining base info fail: %w", err)
} }
// Second query to fetch from mining_base_block // Second query to fetch from mining_base_block
rows, err := t.db.Query(ctx, `SELECT block_cid FROM mining_base_block WHERE task_id = $1`, taskID) rows, err := t.db.Query(ctx, `SELECT block_cid FROM mining_base_block WHERE task_id = $1`, taskID)
if err != nil { if err != nil {
return false, err return false, xerrors.Errorf("query mining base blocks fail: %w", err)
} }
defer rows.Close() defer rows.Close()
@ -126,7 +126,7 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
} }
if err := rows.Err(); err != nil { if err := rows.Err(); err != nil {
return false, err return false, xerrors.Errorf("query mining base blocks fail (rows.Err): %w", err)
} }
// construct base // construct base