Skip to content

Conversation

siddontang
Copy link
Contributor

}

func cloneRegion(r *metapb.Region) *metapb.Region {
if r == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

proto.Clone() checks if it is nil inside.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems region should always be not nil? Do we really need to check this?


if startKey == searchStartKey && endKey == searchEndKey {
// we are the same, must check epoch here.
if err := checkStaleRegion(searchRegion, region); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we check if searchRegion.version == region.version instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need now, because now the mechanism can guarantee that if range is same, the version is same.
But we may handle this later if we introduce merge. @qiuyesuifeng has added a comment here in another PR.

}

return nil, nil
return c.cachedCluster.regions.GetRegion(regionKey), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Need lock here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GetRegion locks inner.

@disksing
Copy link
Contributor

disksing commented Jun 1, 2016

LGTM

1 similar comment
@qiuyesuifeng
Copy link
Contributor

LGTM

@qiuyesuifeng qiuyesuifeng changed the title [DNM] cache all regions Cache all regions Jun 1, 2016
@qiuyesuifeng qiuyesuifeng merged commit 4daaaad into master Jun 1, 2016
@qiuyesuifeng qiuyesuifeng deleted the siddontang/cache-regions branch June 1, 2016 12:20
JmPotato pushed a commit to JmPotato/pd that referenced this pull request Sep 25, 2023
close tikv#6687, close tikv#6688

Add split-range cmd and fix duplicate keyspaces
    
    1. Add split-range cmd to support StartKeyspaceID and EndKeyspaceID parameters.
    2. Fix "split 0 2 2 2" generate duplicate keyspaces in the keyspace list of the group"

Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants