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

*: limit region count #7100

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

overvenus
Copy link
Member

@overvenus overvenus commented Sep 14, 2023

What problem does this PR solve?

Issue Number: ref #6850

cc pingcap/kvproto#1187

What is changed and how does it work?

Limit region count based cluster memory.

Check List

Tests

  • Unit test

Code changes

Side effects

  • Possible performance regression

Related changes

Release note

None.

Signed-off-by: Neil Shen <[email protected]>
Signed-off-by: Neil Shen <[email protected]>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 14, 2023

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 14, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. labels Sep 14, 2023
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 14, 2023
}

// GetReplicaCount get used memory of all stores.
func (s *StoresInfo) GetReplicaCount() uint64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

the func comment is different with the function name.

return bc.Stores.GetReplicaCount()
}

// CheckAllowedRegionReplicaCount get the number of allowed region replica count of the TiKV cluster.
Copy link
Contributor

Choose a reason for hiding this comment

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

needs to fix the function comment.

@@ -58,6 +59,16 @@ const (
defaultEnableWitness = false
defaultHaltScheduling = false

// TODO: set default to false
Copy link
Contributor

Choose a reason for hiding this comment

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

set true if raft engine switch to v2

// See https://gist.github.com/overvenus/4b52386f07ee34cf4dbdc62961b22763
defaultMemoryUsagePerRegionReplicaV1 = typeutil.ByteSize(4 * units.MiB)
// The default memory usage per-region in raftstore v2.
defaultMemoryUsagePerRegionReplicaV2 = typeutil.ByteSize(4 * units.MiB)
Copy link
Contributor

@bufferflies bufferflies Sep 26, 2023

Choose a reason for hiding this comment

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

Can we stat the memory of every region?

@@ -41,6 +43,7 @@ func (se *StorageEndpoint) LoadConfig(cfg interface{}) (bool, error) {
}
err = json.Unmarshal([]byte(value), cfg)
if err != nil {
log.Warn("dbg invalid config", zap.String("value", string(value)))
Copy link
Contributor

Choose a reason for hiding this comment

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

should it need to log the error info?

}

// CheckAllowedRegionReplicaCount get the number of allowed region replica count of the TiKV cluster.
func (bc *BasicCluster) CheckAllowedRegionReplicaCount(count uint64) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a way to alert the user to know cluster alarms.

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2023
Copy link
Contributor

ti-chi-bot bot commented Nov 17, 2023

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants