Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Oct 12, 2023
1 parent 4bd7f02 commit f6e209d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
8 changes: 7 additions & 1 deletion pkg/mcs/scheduling/server/apis/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type server struct {
*scheserver.Server
}

func (s *server) GetCluster() sche.SharedCluster {
func (s *server) GetCluster() sche.SchedulerCluster {
return s.Server.GetCluster()
}

Expand Down Expand Up @@ -439,6 +439,8 @@ func pauseOrResumeScheduler(c *gin.Context) {
// @Summary List the hot write regions.
// @Produce json
// @Success 200 {object} statistics.StoreHotPeersInfos
// @Failure 400 {string} string "The request is invalid."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/regions/write [get]
func getHotWriteRegions(c *gin.Context) {
getHotRegions(utils.Write, c)
Expand All @@ -448,6 +450,8 @@ func getHotWriteRegions(c *gin.Context) {
// @Summary List the hot read regions.
// @Produce json
// @Success 200 {object} statistics.StoreHotPeersInfos
// @Failure 400 {string} string "The request is invalid."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/regions/read [get]
func getHotReadRegions(c *gin.Context) {
getHotRegions(utils.Read, c)
Expand Down Expand Up @@ -494,6 +498,7 @@ func getHotRegions(typ utils.RWType, c *gin.Context) {
// @Summary List the hot stores.
// @Produce json
// @Success 200 {object} handler.HotStoreStats
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/stores [get]
func getHotStores(c *gin.Context) {
handler := c.MustGet(handlerKey).(*handler.Handler)
Expand All @@ -509,6 +514,7 @@ func getHotStores(c *gin.Context) {
// @Summary List the hot buckets.
// @Produce json
// @Success 200 {object} handler.HotBucketsResponse
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/buckets [get]
func getHotBuckets(c *gin.Context) {
handler := c.MustGet(handlerKey).(*handler.Handler)
Expand Down
2 changes: 0 additions & 2 deletions pkg/schedule/core/cluster_informer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ type CheckerCluster interface {
// SharedCluster is an aggregate interface that wraps multiple interfaces
type SharedCluster interface {
BasicCluster
statistics.StoreStatInformer
statistics.RegionStatInformer
buckets.BucketStatInformer

GetBasicCluster() *core.BasicCluster
GetSharedConfig() sc.SharedConfigProvider
Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import (
// TODO: remove it after GetCluster is unified between PD server and Scheduling server.
type Server interface {
GetCoordinator() *schedule.Coordinator
GetCluster() sche.SharedCluster
GetCluster() sche.SchedulerCluster
}

// Handler is a handler to handle http request about schedule.
Expand Down
6 changes: 6 additions & 0 deletions server/api/hot_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func newHotStatusHandler(handler *server.Handler, rd *render.Render) *hotStatusH
// @Summary List the hot write regions.
// @Produce json
// @Success 200 {object} statistics.StoreHotPeersInfos
// @Failure 400 {string} string "The request is invalid."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/regions/write [get]
func (h *hotStatusHandler) GetHotWriteRegions(w http.ResponseWriter, r *http.Request) {
h.getHotRegions(utils.Write, w, r)
Expand All @@ -51,6 +53,8 @@ func (h *hotStatusHandler) GetHotWriteRegions(w http.ResponseWriter, r *http.Req
// @Summary List the hot read regions.
// @Produce json
// @Success 200 {object} statistics.StoreHotPeersInfos
// @Failure 400 {string} string "The request is invalid."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/regions/read [get]
func (h *hotStatusHandler) GetHotReadRegions(w http.ResponseWriter, r *http.Request) {
h.getHotRegions(utils.Read, w, r)
Expand Down Expand Up @@ -95,6 +99,7 @@ func (h *hotStatusHandler) getHotRegions(typ utils.RWType, w http.ResponseWriter
// @Summary List the hot stores.
// @Produce json
// @Success 200 {object} handler.HotStoreStats
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/stores [get]
func (h *hotStatusHandler) GetHotStores(w http.ResponseWriter, r *http.Request) {
stats, err := h.Handler.GetHotStores()
Expand All @@ -109,6 +114,7 @@ func (h *hotStatusHandler) GetHotStores(w http.ResponseWriter, r *http.Request)
// @Summary List the hot buckets.
// @Produce json
// @Success 200 {object} handler.HotBucketsResponse
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /hotspot/buckets [get]
func (h *hotStatusHandler) GetHotBuckets(w http.ResponseWriter, r *http.Request) {
regionIDs := r.URL.Query()["region_id"]
Expand Down
2 changes: 1 addition & 1 deletion server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *server) GetCoordinator() *schedule.Coordinator {
return c.GetCoordinator()
}

func (s *server) GetCluster() sche.SharedCluster {
func (s *server) GetCluster() sche.SchedulerCluster {
return s.GetRaftCluster()
}

Expand Down

0 comments on commit f6e209d

Please sign in to comment.