From d00c8c9f51873374f850d666a12ee9a238d192f1 Mon Sep 17 00:00:00 2001 From: Brian Dillmann Date: Mon, 9 Dec 2024 16:15:24 -0500 Subject: [PATCH] server: deprecate database and index fields on HotRanges proto In changeset #134106, the database, table, and index fields of the HotRanges protobuf were moved to synonymous keys so that there could be multiple of each. This means a hot range could now have multiple indexes, tables and databases contained within it in the UI. During this change however, only the old table key of the protobuf was deprecated, the database and index fields were not flagged for deprecation. This small change fixes this oversight. Release note: None --- pkg/server/api_v2_ranges.go | 12 ++++++------ pkg/server/serverpb/status.proto | 8 ++------ pkg/server/structlogging/hot_ranges_log.go | 3 --- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pkg/server/api_v2_ranges.go b/pkg/server/api_v2_ranges.go index c8e75af8eb50..fa2a06b7b2c5 100644 --- a/pkg/server/api_v2_ranges.go +++ b/pkg/server/api_v2_ranges.go @@ -436,9 +436,9 @@ type hotRangeInfo struct { ReadBytesPerSecond float64 `json:"read_bytes_per_second"` CPUTimePerSecond float64 `json:"cpu_time_per_second"` LeaseholderNodeID roachpb.NodeID `json:"leaseholder_node_id"` - TableName string `json:"table_name"` - DatabaseName string `json:"database_name"` - IndexName string `json:"index_name"` + Databases []string `json:"databases"` + Tables []string `json:"tables"` + Indexes []string `json:"indexes"` SchemaName string `json:"schema_name"` ReplicaNodeIDs []roachpb.NodeID `json:"replica_node_ids"` StoreID roachpb.StoreID `json:"store_id"` @@ -516,9 +516,9 @@ func (a *apiV2Server) listHotRanges(w http.ResponseWriter, r *http.Request) { ReadBytesPerSecond: r.ReadBytesPerSecond, CPUTimePerSecond: r.CPUTimePerSecond, LeaseholderNodeID: r.LeaseholderNodeID, - TableName: r.TableName, - DatabaseName: r.DatabaseName, - IndexName: r.IndexName, + Databases: r.Databases, + Tables: r.Tables, + Indexes: r.Indexes, ReplicaNodeIDs: r.ReplicaNodeIds, SchemaName: r.SchemaName, StoreID: r.StoreID, diff --git a/pkg/server/serverpb/status.proto b/pkg/server/serverpb/status.proto index eb9a0cffd89e..0e781735d343 100644 --- a/pkg/server/serverpb/status.proto +++ b/pkg/server/serverpb/status.proto @@ -1481,12 +1481,6 @@ message HotRangesResponseV2 { double qps = 3 [ (gogoproto.customname) = "QPS" ]; - // table_name has been deprecated in favor of tables = 16; - string table_name = 4 [deprecated = true]; - // database_name has been deprecated in favor of databases = 17; - string database_name = 5; - // index_name has been deprecated in favor of indexes = 17; - string index_name = 6; // replica_node_ids specifies the list of node ids that contain replicas with current hot range. repeated int32 replica_node_ids = 7 [ (gogoproto.casttype) = @@ -1527,6 +1521,8 @@ message HotRangesResponseV2 { repeated string tables = 17; // Indexes for the range repeated string indexes = 18; + // previously used + reserved 4 to 6; } // Ranges contain list of hot ranges info that has highest number of QPS. repeated HotRange ranges = 1; diff --git a/pkg/server/structlogging/hot_ranges_log.go b/pkg/server/structlogging/hot_ranges_log.go index 492ad2e14b73..d17746d775da 100644 --- a/pkg/server/structlogging/hot_ranges_log.go +++ b/pkg/server/structlogging/hot_ranges_log.go @@ -109,10 +109,7 @@ func (s *hotRangesLoggingScheduler) start(ctx context.Context, stopper *stop.Sto hrEvent := &eventpb.HotRangesStats{ RangeID: int64(r.RangeID), Qps: r.QPS, - DatabaseName: r.DatabaseName, SchemaName: r.SchemaName, - TableName: r.TableName, - IndexName: r.IndexName, CPUTimePerSecond: r.CPUTimePerSecond, ReadBytesPerSecond: r.ReadBytesPerSecond, WriteBytesPerSecond: r.WriteBytesPerSecond,