Skip to content

Commit

Permalink
go/worker/executor: Submit failure indicating commitment in case of s…
Browse files Browse the repository at this point in the history
…torage failure
  • Loading branch information
ptrus committed Oct 9, 2020
1 parent 7aa195b commit 60491d1
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions go/worker/compute/executor/committee/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ func (n *Node) proposeBatchLocked(processedBatch *processedBatch) {

// Commit I/O and state write logs to storage.
start := time.Now()
err := func() error {
storageErr := func() error {
span, ctx := tracing.StartSpanWithContext(n.ctx, "Apply(io, state)",
opentracing.ChildOf(state.batch.spanCtx),
)
Expand Down Expand Up @@ -1167,9 +1167,11 @@ func (n *Node) proposeBatchLocked(processedBatch *processedBatch) {
}()
storageCommitLatency.With(n.getMetricLabels()).Observe(time.Since(start).Seconds())

if err != nil {
n.abortBatchLocked(err)
return
if storageErr != nil {
n.logger.Error("storage failure, sibmitting failure indicating commitment",
"err", storageErr,
)
proposedResults.Failure = commitment.FailureStorageUnavailable
}

// Sign the commitment and submit.
Expand Down Expand Up @@ -1197,11 +1199,17 @@ func (n *Node) proposeBatchLocked(processedBatch *processedBatch) {
}()

// TODO: Add crash point.
n.transitionLocked(StateWaitingForFinalize{
batchStartTime: state.batchStartTime,
raw: processedBatch.raw,
proposedIORoot: proposedResults.Header.IORoot,
})

switch storageErr {
case nil:
n.transitionLocked(StateWaitingForFinalize{
batchStartTime: state.batchStartTime,
raw: processedBatch.raw,
proposedIORoot: proposedResults.Header.IORoot,
})
default:
n.abortBatchLocked(err)
}

crash.Here(crashPointBatchProposeAfter)
}
Expand Down

0 comments on commit 60491d1

Please sign in to comment.