From 5ce463804a93d37705ff209c35d221c66a98fa60 Mon Sep 17 00:00:00 2001 From: Zach Lite Date: Tue, 6 Jun 2023 13:22:38 -0400 Subject: [PATCH] server: make SpanStats authoritative This commit guarantees that SpanStats uses up-to-date range descriptors on all nodes. The dependency on DistSender is removed and is replaced with a dependency on rangedesc.Scanner. rangedesc.Scanner is used to: 1) Locate nodes that house replicas of a span to avoid cluster-wide fan-outs. 2) Find Range Descriptors that touch a span, to build a SpanStatsResponse. This commit also fixes #103809, where a SpanStatsResponse incorrectly returned the replica_count for a span, instead of the range_count. Epic: https://cockroachlabs.atlassian.net/browse/CRDB-24928 Issue: https://github.com/cockroachdb/cockroach/issues/103957 Release note (bug fix): SpanStats is no longer subject to stale information, and should be considered authoritative.