From a8d7458a0f57e9e8d249d3dc561a73d5dc74560c Mon Sep 17 00:00:00 2001 From: Andrii Vorobiov Date: Wed, 12 Jan 2022 16:45:38 +0200 Subject: [PATCH] server: nit. add details comments for hot range V2 functions and proto messages Provide more detailed descriptions on implemented functions and proto messages related to Hot Ranges functionality. Release note: None --- docs/generated/http/full.md | 4 ++-- pkg/server/api_v2_ranges.go | 3 ++- pkg/server/serverpb/status.proto | 2 ++ pkg/server/status.go | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/generated/http/full.md b/docs/generated/http/full.md index ff6f23638106..2497cfb42cff 100644 --- a/docs/generated/http/full.md +++ b/docs/generated/http/full.md @@ -3128,7 +3128,7 @@ of ranges currently considered “hot” by the node(s). - +HotRangesResponseV2 is a response payload returned by `HotRangesV2` service. | Field | Type | Label | Description | Support status | @@ -3143,7 +3143,7 @@ of ranges currently considered “hot” by the node(s). #### HotRangesResponseV2.HotRange - +HotRange message describes a single hot range, ie its QPS, node ID it belongs to, etc. | Field | Type | Label | Description | Support status | | ----- | ---- | ----- | ----------- | -------------- | diff --git a/pkg/server/api_v2_ranges.go b/pkg/server/api_v2_ranges.go index f0db6dbbaac8..0ff70a432079 100644 --- a/pkg/server/api_v2_ranges.go +++ b/pkg/server/api_v2_ranges.go @@ -421,7 +421,8 @@ type hotRangesResponse struct { Next string `json:"next,omitempty"` } -// Hot range details +// Hot range details struct describes common information about hot range, +// (ie its range ID, QPS, table name, etc.). // // swagger:model hotRangeInfo type hotRangeInfo struct { diff --git a/pkg/server/serverpb/status.proto b/pkg/server/serverpb/status.proto index 77c0dab9b3fd..383eb53055d7 100644 --- a/pkg/server/serverpb/status.proto +++ b/pkg/server/serverpb/status.proto @@ -1122,7 +1122,9 @@ message HotRangesResponse { ]; } +// HotRangesResponseV2 is a response payload returned by `HotRangesV2` service. message HotRangesResponseV2 { + // HotRange message describes a single hot range, ie its QPS, node ID it belongs to, etc. message HotRange { // range_id indicates Range ID that's identified as hot range int32 range_id = 1 [ diff --git a/pkg/server/status.go b/pkg/server/status.go index e0097b755121..2513938d130b 100644 --- a/pkg/server/status.go +++ b/pkg/server/status.go @@ -2069,6 +2069,8 @@ type hotRangeReportMeta struct { parentId uint32 } +// HotRangesV2 returns hot ranges from all stores on requested node or all nodes in case +// request message doesn't include specific node ID. func (s *statusServer) HotRangesV2( ctx context.Context, req *serverpb.HotRangesRequest, ) (*serverpb.HotRangesResponseV2, error) { @@ -2109,7 +2111,6 @@ func (s *statusServer) HotRangesV2( } var ranges []*serverpb.HotRangesResponseV2_HotRange - // TODO (koorosh): how to flatten triple nested loop? for nodeID, hr := range resp.HotRangesByNodeID { for _, store := range hr.Stores { for _, r := range store.HotRanges {