Skip to content

Commit

Permalink
Fix: prints version of tikv lib
Browse files Browse the repository at this point in the history
  • Loading branch information
solotzg committed Feb 13, 2020
1 parent 7456ba4 commit d797c7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/lib.rs
Expand Up @@ -76,6 +76,11 @@ pub mod server;
pub mod storage;
pub mod tiflash_ffi;

/// Prints version of tikv lib.
pub fn cargo_pkg_version() -> String {
env!("CARGO_PKG_VERSION").to_string()
}

/// Returns the tikv version information.
pub fn tikv_version_info() -> String {
let fallback = "Unknown (env var does not exist when building)";
Expand All @@ -85,7 +90,7 @@ pub fn tikv_version_info() -> String {
\nGit Commit Branch: {}\
\nUTC Build Time: {}\
\nRust Version: {}",
env!("CARGO_PKG_VERSION"),
cargo_pkg_version(),
option_env!("TIKV_BUILD_GIT_HASH").unwrap_or(fallback),
option_env!("TIKV_BUILD_GIT_BRANCH").unwrap_or(fallback),
option_env!("TIKV_BUILD_TIME").unwrap_or(fallback),
Expand Down
2 changes: 1 addition & 1 deletion src/server/node.rs
Expand Up @@ -92,7 +92,7 @@ where
} else {
panic!("tiflash engine addr is empty");
}
store.set_version(env!("CARGO_PKG_VERSION").to_string());
store.set_version(crate::cargo_pkg_version());

let mut labels = Vec::new();
for (k, v) in &cfg.labels {
Expand Down
2 changes: 1 addition & 1 deletion tiflash-proxy/src/lib.rs
Expand Up @@ -32,7 +32,7 @@ fn proxy_version_info() -> String {
\nGit Commit Branch: {}\
\nUTC Build Time: {}\
\nRust Version: {}",
env!("CARGO_PKG_VERSION"),
tikv::cargo_pkg_version(),
option_env!("PROXY_BUILD_GIT_HASH").unwrap_or(fallback),
option_env!("PROXY_BUILD_GIT_BRANCH").unwrap_or(fallback),
option_env!("PROXY_BUILD_TIME").unwrap_or(fallback),
Expand Down

0 comments on commit d797c7f

Please sign in to comment.