Skip to content

Commit

Permalink
server: reduce log spam on canceled batch requests
Browse files Browse the repository at this point in the history
In #102793 we added server side logging for batch requests
that would encounted a context cancelation or timeout. This
was primarily motivated by the need to understand why export
requests sent during a backup were spending most of their time
and timing out. This unintentionally added log spam for other
kinds of internal requests such as HeartbeatTxn, QueryTxn,
and EndTxn requests. This change limits this log line to only
be printed when the corresponding request is an export request.

Fixes: None
Release note: None
  • Loading branch information
adityamaru committed Nov 27, 2023
1 parent f90df1f commit 5b18a8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/server/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,10 @@ func (n *Node) batchInternal(
// replica to notice the cancellation and return a response. For this reason,
// we log the server-side trace of the cancelled request to help debug what
// the request was doing at the time it noticed the cancellation.
if pErr != nil && ctx.Err() != nil {
//
// To avoid log spam for now we only log the trace if the request was an
// ExportRequest.
if pErr != nil && ctx.Err() != nil && args.IsSingleExportRequest() {
if sp := tracing.SpanFromContext(ctx); sp != nil && !sp.IsNoop() {
recording := sp.GetConfiguredRecording()
if recording.Len() != 0 {
Expand Down

0 comments on commit 5b18a8c

Please sign in to comment.