Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store label limit #2674

Closed
wants to merge 8 commits into from
Closed

Store label limit #2674

wants to merge 8 commits into from

Conversation

ZenoTan
Copy link
Contributor

@ZenoTan ZenoTan commented Jul 22, 2020

What problem does this PR solve?

Solve issue #2568

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Support adjust store limit according to label, by adding a map from label to store limit. Some necessary code changes are also performed.

Side effects

Related changes

Release note

@ti-srebot ti-srebot added the contribution This PR is from a community contributor. label Jul 22, 2020
if keyOk {
if limit, err := h.GetLabelStoresLimit(label, 0); err != nil {
return
} else {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

@@ -1695,6 +1695,21 @@ func (c *RaftCluster) GetStoreLimitByType(storeID uint64, typ storelimit.Type) f
return c.opt.GetStoreLimitByType(storeID, typ)
}

func (c *RaftCluster) GetLabelStores(label config.StoreLabel) []uint64 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method RaftCluster.GetLabelStores should have comment or be unexported

if keyOk {
if limit, err := h.GetLabelStoresLimit(label, 0); err != nil {
return
} else {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

// IsTiFlashStore used to judge flash store.
// FIXME: remove the hack way
func IsTiFlashStore(store *metapb.Store) bool {
// Judge if it needs placement rule.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment on exported function IsPlacementNeeded should be of the form "IsPlacementNeeded ..."

func (o *PersistOptions) GetLabelStoresLimit(label StoreLabel) StoreLimitConfig {
if l, ok := o.GetScheduleConfig().StoreLabelLimit[label.String()]; !ok {
return l
} else {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

@@ -1695,6 +1695,21 @@ func (c *RaftCluster) GetStoreLimitByType(storeID uint64, typ storelimit.Type) f
return c.opt.GetStoreLimitByType(storeID, typ)
}

func (c *RaftCluster) GetLabelStores(label config.StoreLabel) []uint64 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method RaftCluster.GetLabelStores should have comment or be unexported

@@ -419,6 +429,15 @@ func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Typ
return nil
}

// GetAllStoresLimit is used to get limit of all stores.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment on exported method Handler.GetLabelStoresLimit should be of the form "GetLabelStoresLimit ..."

@ZenoTan ZenoTan closed this Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants