-
Notifications
You must be signed in to change notification settings - Fork 2
chore: bump version to 260304.0.0 #89
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
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,144 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Copyright 2021 Datafuse Labs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //! Changelog of gRPC version compatibility. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //! Records the minimum compatible client and server versions at each package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //! version where compatibility changed. Consumers use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //! `.range(..=v).last()` to find the applicable entry for a given version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use std::collections::BTreeMap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use crate::version::Version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Min-compatible client and server versions at a given package version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub struct GrpcVersionCompat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub min_client: Version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub min_server: Version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Returns a changelog mapping each package version (where compatibility | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// changed) to the min-compatible client and server versions at that point. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Only versions where `min_client` or `min_server` changed are included. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub fn grpc_changelog() -> BTreeMap<Version, GrpcVersionCompat> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const fn ver(major: u64, minor: u64, patch: u64) -> Version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Version::new(major, minor, patch) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let mut m = BTreeMap::new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 260205.0.0: client adds ExpireInMillis, PutSequential (server since 1.2.770) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m.insert(ver(260205, 0, 0), GrpcVersionCompat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
drmingdrmer marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_client: ver(1, 2, 676), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_server: ver(1, 2, 770), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 260214.0.0: client adds KvGetMany(srv:1.2.869), TransactionPrevValue(srv:1.2.304) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m.insert(ver(260214, 0, 0), GrpcVersionCompat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_client: ver(1, 2, 676), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_server: ver(1, 2, 869), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 260217.0.0: client adds KvTransactionPutMatchSeq (server since 260217.0.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[cfg(feature = "txn-put-match-seq")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m.insert(ver(260217, 0, 0), GrpcVersionCompat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_client: ver(1, 2, 676), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_server: ver(260217, 0, 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 260217.0.0: without txn-put-match-seq, no new client requirement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[cfg(not(feature = "txn-put-match-seq"))] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m.insert(ver(260217, 0, 0), GrpcVersionCompat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_client: ver(1, 2, 676), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_server: ver(1, 2, 869), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 260304.0.0: no compatibility change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[cfg(feature = "txn-put-match-seq")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m.insert(ver(260304, 0, 0), GrpcVersionCompat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_client: ver(1, 2, 676), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_server: ver(260217, 0, 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[cfg(not(feature = "txn-put-match-seq"))] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m.insert(ver(260304, 0, 0), GrpcVersionCompat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_client: ver(1, 2, 676), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_server: ver(1, 2, 869), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+32
to
+80
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[cfg(test)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mod tests { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use super::*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use crate::MIN_CLIENT_VERSION; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use crate::MIN_SERVER_VERSION; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fn test_grpc_changelog_contains_current_version() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let changelog = grpc_changelog(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let current = *crate::version(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert!( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| changelog.contains_key(¤t), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "changelog must contain an entry for the current version {}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+96
to
+100
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert!( | |
| changelog.contains_key(¤t), | |
| "changelog must contain an entry for the current version {}", | |
| current | |
| ); | |
| let (_, compat) = changelog | |
| .range(..=current) | |
| .next_back() | |
| .unwrap_or_else(|| { | |
| panic!( | |
| "changelog must contain an entry for or before the current version {}", | |
| current | |
| ) | |
| }); | |
| assert_eq!( | |
| compat.min_client, MIN_CLIENT_VERSION, | |
| "changelog entry for or before current version {} must match MIN_CLIENT_VERSION", | |
| current | |
| ); | |
| assert_eq!( | |
| compat.min_server, MIN_SERVER_VERSION, | |
| "changelog entry for or before current version {} must match MIN_SERVER_VERSION", | |
| current | |
| ); |
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.
The docs recommend using
.range(..=v).last()to find the applicable entry. On aBTreeMap,last()will iterate through the entire range (O(n)); sinceBTreeMap::Rangeis aDoubleEndedIterator, using.range(..=v).next_back()returns the same entry without scanning.