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

core: add buckets property to regionInfo struct #4743

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions server/core/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type RegionInfo struct {
replicationStatus *replication_modepb.RegionReplicationStatus
QueryStats *pdpb.QueryStats
flowRoundDivisor uint64
buckets *metapb.Buckets
}

// NewRegionInfo creates RegionInfo with region's meta and leader peer.
Expand Down Expand Up @@ -214,6 +215,14 @@ func (r *RegionInfo) Clone(opts ...RegionCreateOption) *RegionInfo {
return region
}

// GetBuckets returns the buckets of the region.
func (r *RegionInfo) GetBuckets() *metapb.Buckets {
if r == nil {
Copy link
Member

Choose a reason for hiding this comment

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

When will it happen?

Copy link
Contributor Author

@bufferflies bufferflies Mar 17, 2022

Choose a reason for hiding this comment

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

this is the first step, sync regions and api related region will use it, I will split them into different pr. like this:#4699 and pingcap/kvproto#867.

Copy link
Member

Choose a reason for hiding this comment

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

I mean r == nil

return nil
}
return r.buckets
}

// GetTerm returns the current term of the region
func (r *RegionInfo) GetTerm() uint64 {
return r.term
Expand Down