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

why calculate keyspace ID every time in the request with V2 VPI #811

Closed
siddontang opened this issue May 22, 2023 · 0 comments
Closed

why calculate keyspace ID every time in the request with V2 VPI #811

siddontang opened this issue May 22, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@siddontang
Copy link
Contributor

I found that now with V2 API, we will calculate the keyspace every time

func (c *codecV2) GetKeyspaceID() KeyspaceID {
	prefix := append([]byte{}, c.prefix...)
	prefix[0] = 0
	return KeyspaceID(binary.BigEndian.Uint32(prefix))
}

https://github.com/tikv/client-go/blob/master/internal/apicodec/codec_v2.go#L99

Why do we do this? seem that we can cache the value of KeyspaceID in the codecV2 structure directly.

@sunxiaoguang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants