Skip to content

Commit

Permalink
[FAB-18479] Log error if orderer can't forward SubmitRequest to Raft …
Browse files Browse the repository at this point in the history
…leader

If order cannot forward client transaction SubmitRequest to Raft leader,
it only logged it in a debug message. And since the error does
not get returned to the client either, it is difficult to identify
and troubleshoot.

This commit changes the message to an error in the orderer log.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
(cherry picked from commit e8e39e6)
  • Loading branch information
denyeart committed May 31, 2021
1 parent dd7e921 commit 56b3689
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions orderer/common/cluster/comm.go
Expand Up @@ -521,26 +521,26 @@ func (stream *Stream) sendOrDrop(request *orderer.StepRequest, allowDrop bool) e
case <-stream.abortChan:
return errors.Errorf("stream %d aborted", stream.ID)
case stream.sendBuff <- request:
// Note - async send, errors are not returned back
return nil
case <-stream.commShutdown:
return nil
}
}

// sendMessage sends the request down the stream
// Note - any errors are swallowed and not returned back - TODO Is this intentional? Shouldn't SubmitRequest errors get returned to client?
func (stream *Stream) sendMessage(request *orderer.StepRequest) {
start := time.Now()
var err error
defer func() {
if !stream.Logger.IsEnabledFor(zap.DebugLevel) {
return
}
var result string
message := fmt.Sprintf("Send of %s to %s(%s) took %v",
requestAsString(request), stream.NodeName, stream.Endpoint, time.Since(start))
if err != nil {
result = fmt.Sprintf("but failed due to %s", err.Error())
stream.Logger.Errorf("%s but failed due to %s", message, err.Error())
} else {
stream.Logger.Debug(message)
}
stream.Logger.Debugf("Send of %s to %s(%s) took %v %s", requestAsString(request),
stream.NodeName, stream.Endpoint, time.Since(start), result)
}()

f := func() (*orderer.StepResponse, error) {
Expand Down

0 comments on commit 56b3689

Please sign in to comment.