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

Add version in store's meta information #285

Merged
merged 6 commits into from
Jul 18, 2018

Conversation

nolouch
Copy link
Member

@nolouch nolouch commented Jul 6, 2018

For compatibility upgrade.

@nolouch nolouch requested review from BusyJay and disksing July 6, 2018 03:59
proto/pdpb.proto Outdated
@@ -53,12 +53,15 @@ service PD {
message RequestHeader {
// cluster_id is the ID of the cluster which be sent to.
uint64 cluster_id = 1;
string version = 2;
string require_min_version = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need some comments here.

@siddontang
Copy link
Member

I prefer using number (major, minor, patch, unstable) for version, not string

Btw, containing the version in every request is heavy?

@disksing
Copy link
Contributor

disksing commented Jul 9, 2018

@siddontang Differs from your point of view, I think string is better. It's more readable, easier to construct a message, and more convenient to compare by using appropriate package (e.g. https://github.com/blang/semver)

@Hoverbear
Copy link
Contributor

@disksing If we're serializing this onto every request I would be interested if there is a size difference between choosing string or a (u8,u8,u8,u8) as @siddontang suggested.

@disksing
Copy link
Contributor

@Hoverbear I don't think the difference will be too significant. Notice that protobuf needs to use an extra varint to marshal each field.

@nolouch
Copy link
Member Author

nolouch commented Jul 10, 2018

Actually, I compare them via:

	h := &pdpb.RequestHeader{
		ClusterId:         6571635133475700175,
		Version:           "v2.0.0-rc3",
		RequireMinVersion: "v2.0.0-rc4",
	}
	b, _ := proto.Marshal(h)
	fmt.Println("RequestHeader:", len(b))
	fmt.Println("RequestHeader(gizp):", gzipLen(b))

	v := &pdpb.Version{Major: 2, Minor: 1, Patch: 1, Unstable: 1}
	v2 := &pdpb.Version{Major: 2, Minor: 1, Patch: 1, Unstable: 14}
	h2 := &pdpb.RequestHeader2{
		ClusterId:         6571635133475700175,
		Version:           v,
		RequireMinVersion: v2,
	}

	b, _ = proto.Marshal(h2)
	fmt.Println("RequestHeader(use Version):", len(b))
	fmt.Println("RequestHeader2(use Version & gizp):", gzipLen(b))

The Result:

RequestHeader: 34
RequestHeader(gizp): 56
RequestHeader2(use Version): 30
RequestHeader2(use Version & gizp): 54

@nolouch
Copy link
Member Author

nolouch commented Jul 18, 2018

PTAL @disksing @siddontang

@nolouch nolouch requested review from siddontang and disksing July 18, 2018 04:05
@disksing
Copy link
Contributor

LGTM. Please use a more appropriate PR title.

@nolouch nolouch changed the title Version introduce Add version in store's meta information Jul 18, 2018
Copy link
Member

@rleungx rleungx left a comment

Choose a reason for hiding this comment

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

LGTM

@nolouch nolouch merged commit 5e6e69a into pingcap:master Jul 18, 2018
@nolouch nolouch deleted the version-introduce branch July 18, 2018 07:09
sticnarf pushed a commit to sticnarf/kvproto that referenced this pull request Oct 27, 2019
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.

5 participants