Skip to content

Commit

Permalink
Merge branch 'master' into fix-test-2024-33
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot[bot] authored Nov 18, 2024
2 parents 960756c + b6826c2 commit dc15361
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 744 deletions.
52 changes: 0 additions & 52 deletions pkg/core/storelimit/store_limit_scenes.go

This file was deleted.

2 changes: 0 additions & 2 deletions server/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ func createRouter(prefix string, svr *server.Server) *mux.Router {
registerFunc(clusterRouter, "/stores/remove-tombstone", storesHandler.RemoveTombStone, setMethods(http.MethodDelete), setAuditBackend(localLog, prometheus))
registerFunc(clusterRouter, "/stores/limit", storesHandler.GetAllStoresLimit, setMethods(http.MethodGet), setAuditBackend(prometheus))
registerFunc(clusterRouter, "/stores/limit", storesHandler.SetAllStoresLimit, setMethods(http.MethodPost), setAuditBackend(localLog, prometheus))
registerFunc(clusterRouter, "/stores/limit/scene", storesHandler.SetStoreLimitScene, setMethods(http.MethodPost), setAuditBackend(localLog, prometheus))
registerFunc(clusterRouter, "/stores/limit/scene", storesHandler.GetStoreLimitScene, setMethods(http.MethodGet), setAuditBackend(prometheus))
registerFunc(clusterRouter, "/stores/progress", storesHandler.GetStoresProgress, setMethods(http.MethodGet), setAuditBackend(prometheus))
registerFunc(clusterRouter, "/stores/check", storesHandler.GetStoresByState, setMethods(http.MethodGet), setAuditBackend(prometheus))

Expand Down
40 changes: 0 additions & 40 deletions server/api/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,46 +528,6 @@ func (h *storesHandler) GetAllStoresLimit(w http.ResponseWriter, r *http.Request
h.rd.JSON(w, http.StatusOK, limits)
}

// @Tags store
// @Summary Set limit scene in the cluster.
// @Accept json
// @Param body body storelimit.Scene true "Store limit scene"
// @Produce json
// @Success 200 {string} string "Set store limit scene successfully."
// @Failure 400 {string} string "The input is invalid."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /stores/limit/scene [post]
func (h *storesHandler) SetStoreLimitScene(w http.ResponseWriter, r *http.Request) {
typeName := r.URL.Query().Get("type")
typeValue, err := parseStoreLimitType(typeName)
if err != nil {
h.rd.JSON(w, http.StatusBadRequest, err.Error())
return
}
scene := h.Handler.GetStoreLimitScene(typeValue)
if err := apiutil.ReadJSONRespondError(h.rd, w, r.Body, &scene); err != nil {
return
}
h.Handler.SetStoreLimitScene(scene, typeValue)
h.rd.JSON(w, http.StatusOK, "Set store limit scene successfully.")
}

// @Tags store
// @Summary Get limit scene in the cluster.
// @Produce json
// @Success 200 {string} string "Get store limit scene successfully."
// @Router /stores/limit/scene [get]
func (h *storesHandler) GetStoreLimitScene(w http.ResponseWriter, r *http.Request) {
typeName := r.URL.Query().Get("type")
typeValue, err := parseStoreLimitType(typeName)
if err != nil {
h.rd.JSON(w, http.StatusBadRequest, err.Error())
return
}
scene := h.Handler.GetStoreLimitScene(typeValue)
h.rd.JSON(w, http.StatusOK, scene)
}

// Progress contains status about a progress.
type Progress struct {
Action string `json:"action"`
Expand Down
11 changes: 2 additions & 9 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ type RaftCluster struct {
prevStoreLimit map[uint64]map[storelimit.Type]float64

// This below fields are all read-only, we cannot update itself after the raft cluster starts.
id id.Allocator
opt *config.PersistOptions
limiter *StoreLimiter
id id.Allocator
opt *config.PersistOptions
*schedulingController
ruleManager *placement.RuleManager
regionLabeler *labeler.RegionLabeler
Expand Down Expand Up @@ -354,7 +353,6 @@ func (c *RaftCluster) Start(s Server) error {
if err != nil {
return err
}
c.limiter = NewStoreLimiter(s.GetPersistOptions())
c.loadExternalTS()
c.loadMinResolvedTS()

Expand Down Expand Up @@ -2177,11 +2175,6 @@ func (c *RaftCluster) putRegion(region *core.RegionInfo) error {
return nil
}

// GetStoreLimiter returns the dynamic adjusting limiter
func (c *RaftCluster) GetStoreLimiter() *StoreLimiter {
return c.limiter
}

// GetStoreLimitByType returns the store limit for a given store ID and type.
func (c *RaftCluster) GetStoreLimitByType(storeID uint64, typ storelimit.Type) float64 {
return c.opt.GetStoreLimitByType(storeID, typ)
Expand Down
Loading

0 comments on commit dc15361

Please sign in to comment.