-
Notifications
You must be signed in to change notification settings - Fork 726
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
*: Introduce version checking mechanism #1148
Changes from 1 commit
cd02a27
52bee45
595f133
2fdd381
efc59f1
726ef07
3178fae
cbe6d32
9997f8d
d18d0aa
13bccce
69cf420
9d81d84
9e6866e
f51bacf
365da06
e1a3e65
2eaabf1
0a1cea3
2b73eed
71bbf0f
e15af4f
7d9a99e
5bfb86f
4b007fa
94542d0
3fa0a54
4478e41
5eeca3d
3f711b8
d099292
e40ff3d
1693736
8dccabd
c7c42ca
89a1d93
a01fc8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -548,8 +548,11 @@ func (s *Server) SetClusterVersion(v string) error { | |
if err != nil { | ||
return errors.Trace(err) | ||
} | ||
err = s.scheduleOpt.persist(s.kv) | ||
if err != nil { | ||
return errors.Trace(err) | ||
} | ||
s.scheduleOpt.SetClusterVersion(*version) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you want to update the version before persisting it. |
||
s.scheduleOpt.persist(s.kv) | ||
log.Infof("cluster version is updated to %s", v) | ||
return nil | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,17 +25,20 @@ type Feature int | |
const ( | ||
Base Feature = iota | ||
Version2_0 | ||
// RegionMerge supports the adjacent regions to be merge. | ||
RegionMerge | ||
// RaftLearner supports add a non-voting member in raft members. | ||
RaftLearner | ||
// BatchSplit can speed up the region split. | ||
BatchSplit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to add some comments to describe the meaning of these features. |
||
) | ||
|
||
var featuresDict = map[Feature]semver.Version{ | ||
Base: {Major: 1}, | ||
Version2_0: {Major: 2}, | ||
RegionMerge: {Major: 2, Minor: 0}, | ||
RaftLearner: {Major: 2, Minor: 0}, | ||
BatchSplit: {Major: 2, Minor: 1}, | ||
var featuresDict = map[Feature]string{ | ||
Base: "1.0.0", | ||
Version2_0: "2.0.0", | ||
RegionMerge: "2.0.0", | ||
RaftLearner: "2.0.0", | ||
BatchSplit: "2.1.0", | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will it be more readable to use string style? like |
||
|
||
// MinSupportedVersion returns the minimum support version for the specified feature. | ||
|
@@ -44,7 +47,8 @@ func MinSupportedVersion(v Feature) semver.Version { | |
if !ok { | ||
log.Fatalf("the corresponding version of the feature %d doesn't exist", v) | ||
} | ||
return target | ||
version := MustParseVersion(target) | ||
return *version | ||
} | ||
|
||
// ParseVersion wraps semver.NewVersion and handles compatibility issues. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to update the version before persisting it.