Skip to content

Commit

Permalink
server: nit. add details comments for hot range V2 functions and prot…
Browse files Browse the repository at this point in the history
…o messages

Provide more detailed descriptions on implemented functions and
proto messages related to Hot Ranges functionality.

Release note: None
  • Loading branch information
koorosh committed Jan 12, 2022
1 parent 8f19280 commit a8d7458
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/generated/http/full.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -3143,7 +3143,7 @@ of ranges currently considered “hot” by the node(s).
<a name="cockroach.server.serverpb.HotRangesResponseV2-cockroach.server.serverpb.HotRangesResponseV2.HotRange"></a>
#### HotRangesResponseV2.HotRange


HotRange message describes a single hot range, ie its QPS, node ID it belongs to, etc.

| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
Expand Down
3 changes: 2 additions & 1 deletion pkg/server/api_v2_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions pkg/server/serverpb/status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
3 changes: 2 additions & 1 deletion pkg/server/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a8d7458

Please sign in to comment.