Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/server/span_stats_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func (s *systemStatusServer) spanStatsFanOut(

nodeSpans := spansPerNode[nodeID]
var spansRequiringMvcc []roachpb.Span
skipMvcc := false

// If SkipApproxTotalStats is set, we only need MVCC stats from one node per span.
// Build the list of spans that this node should collect MVCC stats for.
Expand All @@ -132,13 +133,21 @@ func (s *systemStatusServer) spanStatsFanOut(
spansRequiringMvcc = append(spansRequiringMvcc, span)
}
}
// If this node is not the designated MVCC node for any of its spans,
// skip MVCC collection entirely. An empty SpansRequiringMvcc is
// ambiguous with the "not participating" case (proto3 zero-value).
// Disambiguate by setting SkipMvccStats explicitly.
if len(spansRequiringMvcc) == 0 {
skipMvcc = true
}
}

resp, err := client.(serverpb.RPCStatusClient).SpanStats(ctx,
&roachpb.SpanStatsRequest{
NodeID: nodeID.String(),
Spans: nodeSpans,
SpansRequiringMvcc: spansRequiringMvcc,
SkipMvccStats: skipMvcc,
})
return resp, err
}
Expand Down