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

bin: inline tikv::binutil::* so that CARGO_PKG_VERSION is the correct version #14

Merged
merged 1 commit into from
Aug 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions src/bin/tikv-importer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,42 @@ use tikv::binutil::signal_handler;

use clap::{crate_authors, crate_version, App, Arg, ArgMatches};

#[cfg(unix)]
use tikv::binutil as util;
use tikv::fatal;
use tikv_importer::import::{ImportKVServer, TiKvConfig};
use tikv_util::{self as tikv_util, check_environment_variables, logger};

/// Returns the importer version information.
fn importer_version_info() -> String {
let fallback = "Unknown (env var does not exist when building)";
format!(
"\nRelease Version: {}\
\nGit Commit Hash: {}\
\nGit Commit Branch: {}\
\nUTC Build Time: {}\
\nRust Version: {}",
env!("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),
option_env!("TIKV_BUILD_RUSTC_VERSION").unwrap_or(fallback),
)
}

/// Prints the tikv version information to the standard output.
fn log_importer_info() {
info!("Welcome to TiKV Importer.");
for line in importer_version_info().lines() {
info!("{}", line);
}
info!("");
}

fn main() {
let matches = App::new("TiKV Importer")
.about("The importer server for TiKV")
.author(crate_authors!())
.version(crate_version!())
.long_version(util::tikv_version_info().as_ref())
.long_version(&*importer_version_info())
.arg(
Arg::with_name("config")
.short("C")
Expand Down Expand Up @@ -79,7 +103,7 @@ fn main() {
tikv_util::set_panic_hook(false, &config.storage.data_dir);

initial_metric(&config.metric, None);
util::log_tikv_info();
log_importer_info();
check_environment_variables();

if tikv_util::panic_mark_file_exists(&config.storage.data_dir) {
Expand Down