journal: wdpost: record proofs_processed even if no eligible partitions.
This commit is contained in:
parent
200b0f72cc
commit
cc859d3948
@ -61,16 +61,34 @@ func (s *WindowPoStScheduler) doPost(ctx context.Context, deadline *miner.Deadli
|
|||||||
ctx, span := trace.StartSpan(ctx, "WindowPoStScheduler.doPost")
|
ctx, span := trace.StartSpan(ctx, "WindowPoStScheduler.doPost")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
|
// recordEvent records a successful proofs_processed event in the
|
||||||
|
// journal, even if it was a noop (no partitions).
|
||||||
|
recordEvent := func(partitions []miner.PoStPartition, mcid cid.Cid) {
|
||||||
|
journal.MaybeRecordEvent(s.jrnl, s.wdPoStEvtType, func() interface{} {
|
||||||
|
return s.enrichWithTipset(WindowPoStEvt{
|
||||||
|
State: "proofs_processed",
|
||||||
|
Deadline: s.activeDeadline,
|
||||||
|
Proofs: &WindowPoStEvt_Proofs{
|
||||||
|
Partitions: partitions,
|
||||||
|
MessageCID: mcid,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
proof, err := s.runPost(ctx, *deadline, ts)
|
proof, err := s.runPost(ctx, *deadline, ts)
|
||||||
switch err {
|
switch err {
|
||||||
case errNoPartitions:
|
case errNoPartitions:
|
||||||
|
recordEvent(nil, cid.Undef)
|
||||||
return
|
return
|
||||||
case nil:
|
case nil:
|
||||||
if err := s.submitPost(ctx, proof); err != nil {
|
sm, err := s.submitPost(ctx, proof)
|
||||||
|
if err != nil {
|
||||||
log.Errorf("submitPost failed: %+v", err)
|
log.Errorf("submitPost failed: %+v", err)
|
||||||
s.failPost(err, deadline)
|
s.failPost(err, deadline)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
recordEvent(proof.Partitions, sm.Cid())
|
||||||
default:
|
default:
|
||||||
log.Errorf("runPost failed: %+v", err)
|
log.Errorf("runPost failed: %+v", err)
|
||||||
s.failPost(err, deadline)
|
s.failPost(err, deadline)
|
||||||
@ -495,31 +513,15 @@ func (s *WindowPoStScheduler) sectorInfo(ctx context.Context, deadlineSectors *a
|
|||||||
return sbsi, nil
|
return sbsi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.SubmitWindowedPoStParams) error {
|
func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.SubmitWindowedPoStParams) (*types.SignedMessage, error) {
|
||||||
ctx, span := trace.StartSpan(ctx, "storage.commitPost")
|
ctx, span := trace.StartSpan(ctx, "storage.commitPost")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
var sm *types.SignedMessage
|
var sm *types.SignedMessage
|
||||||
|
|
||||||
defer journal.MaybeRecordEvent(s.jrnl, s.wdPoStEvtType, func() interface{} {
|
|
||||||
var mcid cid.Cid
|
|
||||||
if sm != nil {
|
|
||||||
mcid = sm.Cid()
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.enrichWithTipset(WindowPoStEvt{
|
|
||||||
State: "proofs_processed",
|
|
||||||
Deadline: s.activeDeadline,
|
|
||||||
Proofs: &WindowPoStEvt_Proofs{
|
|
||||||
Partitions: proof.Partitions,
|
|
||||||
MessageCID: mcid,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
enc, aerr := actors.SerializeParams(proof)
|
enc, aerr := actors.SerializeParams(proof)
|
||||||
if aerr != nil {
|
if aerr != nil {
|
||||||
return xerrors.Errorf("could not serialize submit post parameters: %w", aerr)
|
return nil, xerrors.Errorf("could not serialize submit post parameters: %w", aerr)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := &types.Message{
|
msg := &types.Message{
|
||||||
@ -534,7 +536,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi
|
|||||||
var err error
|
var err error
|
||||||
sm, err = s.api.MpoolPushMessage(ctx, msg)
|
sm, err = s.api.MpoolPushMessage(ctx, msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("pushing message to mpool: %w", err)
|
return nil, xerrors.Errorf("pushing message to mpool: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Submitted window post: %s", sm.Cid())
|
log.Infof("Submitted window post: %s", sm.Cid())
|
||||||
@ -553,5 +555,5 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi
|
|||||||
log.Errorf("Submitting window post %s failed: exit %d", sm.Cid(), rec.Receipt.ExitCode)
|
log.Errorf("Submitting window post %s failed: exit %d", sm.Cid(), rec.Receipt.ExitCode)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return nil
|
return sm, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user