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

*: move util as a component #4504

Merged
merged 7 commits into from Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 53 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Expand Up @@ -83,7 +83,6 @@ backtrace = "0.2.3"
clap = "2.32"
url = "1.5"
regex = "1.0"
fnv = "1.0"
sys-info = "0.5.1"
indexmap = { version = "1.0", features = ["serde-1"] }
futures = "0.1"
Expand Down Expand Up @@ -122,6 +121,7 @@ tipb = { git = "https://github.com/pingcap/tipb.git" }
kvproto = { git = "https://github.com/pingcap/kvproto.git" }
log_wrappers = { path = "components/log_wrappers" }
engine = { path = "components/engine" }
tikv_util = { path = "components/tikv_util" }

[dependencies.murmur3]
git = "https://github.com/pingcap/murmur3.git"
Expand Down Expand Up @@ -165,6 +165,7 @@ members = [
"components/panic_hook",
"components/cop_datatype",
"components/log_wrappers",
"components/tikv_util",
]

[profile.dev]
Expand Down
2 changes: 1 addition & 1 deletion benches/misc/coprocessor/dag/expr/scalar.rs
@@ -1,6 +1,6 @@
use std::usize;
use test::{black_box, Bencher};
use tikv::util::collections::HashMap;
use tikv_util::collections::HashMap;
use tipb::expression::ScalarFuncSig;

fn get_scalar_args_with_match(sig: ScalarFuncSig) -> (usize, usize) {
Expand Down
3 changes: 1 addition & 2 deletions benches/misc/mod.rs
Expand Up @@ -4,7 +4,6 @@

extern crate test;

mod channel;
mod coprocessor;
mod raftkv;
mod serialization;
Expand All @@ -14,5 +13,5 @@ mod writebatch;

#[bench]
fn _bench_check_requirement(_: &mut test::Bencher) {
tikv::util::config::check_max_open_fds(4096).unwrap();
tikv_util::config::check_max_open_fds(4096).unwrap();
}
2 changes: 1 addition & 1 deletion benches/misc/serialization/bench_serialization.rs
Expand Up @@ -7,7 +7,7 @@ use protobuf::{self, Message};
use rand::{thread_rng, Rng};
use test::Bencher;

use tikv::util::collections::HashMap;
use tikv_util::collections::HashMap;

#[inline]
fn gen_rand_str(len: usize) -> Vec<u8> {
Expand Down
2 changes: 1 addition & 1 deletion benches/raftstore/mod.rs
Expand Up @@ -171,7 +171,7 @@ impl fmt::Debug for ServerClusterFactory {
}

fn main() {
::tikv::util::config::check_max_open_fds(4096).unwrap();
tikv_util::config::check_max_open_fds(4096).unwrap();

let mut criterion = Criterion::default().configure_from_args().sample_size(10);
bench_raft_cluster(&mut criterion, NodeClusterFactory {});
Expand Down
2 changes: 1 addition & 1 deletion components/engine/src/lib.rs
Expand Up @@ -56,7 +56,7 @@ pub const LARGE_CFS: &[CfName] = &[CF_DEFAULT, CF_WRITE];
pub const ALL_CFS: &[CfName] = &[CF_DEFAULT, CF_LOCK, CF_WRITE, CF_RAFT];
pub const DATA_CFS: &[CfName] = &[CF_DEFAULT, CF_LOCK, CF_WRITE];

// A copy of `tikv::util::escape`.
// A copy of `tikv_util::escape`.
// TODO: remove it once util becomes a component.
fn escape(data: &[u8]) -> String {
let mut escaped = Vec::with_capacity(data.len() * 4);
Expand Down
1 change: 1 addition & 0 deletions components/test_coprocessor/Cargo.toml
Expand Up @@ -5,6 +5,7 @@ edition = "2018"
publish = false

[dependencies]
tikv_util = { path = "../tikv_util" }
tikv = { path = "../../", default-features = false }
tipb = { git = "https://github.com/pingcap/tipb.git" }
kvproto = { git = "https://github.com/pingcap/kvproto.git" }
Expand Down
2 changes: 1 addition & 1 deletion components/test_coprocessor/src/dag.rs
Expand Up @@ -16,7 +16,7 @@ use tipb::select::{Chunk, DAGRequest};

use tikv::coprocessor::codec::{datum, Datum};
use tikv::coprocessor::REQ_TYPE_DAG;
use tikv::util::codec::number::NumberEncoder;
use tikv_util::codec::number::NumberEncoder;

pub struct DAGSelect {
pub execs: Vec<Executor>,
Expand Down
2 changes: 1 addition & 1 deletion components/test_coprocessor/src/fixture.rs
Expand Up @@ -10,7 +10,7 @@ use tikv::server::readpool::{self, ReadPool};
use tikv::server::Config;
use tikv::storage::kv::RocksEngine;
use tikv::storage::{Engine, TestEngineBuilder};
use tikv::util::worker::FutureWorker;
use tikv_util::worker::FutureWorker;

#[derive(Clone)]
pub struct ProductTable(Table);
Expand Down
2 changes: 1 addition & 1 deletion components/test_coprocessor/src/store.rs
Expand Up @@ -9,7 +9,7 @@ use kvproto::kvrpcpb::Context;
use test_storage::{SyncTestStorage, SyncTestStorageBuilder};
use tikv::coprocessor::codec::{datum, table, Datum};
use tikv::storage::{Engine, FixtureStore, Key, Mutation, RocksEngine, TestEngineBuilder};
use tikv::util::collections::HashMap;
use tikv_util::collections::HashMap;

pub struct Insert<'a, E: Engine> {
store: &'a mut Store<E>,
Expand Down
2 changes: 1 addition & 1 deletion components/test_coprocessor/src/table.rs
Expand Up @@ -11,7 +11,7 @@ use protobuf::RepeatedField;

use tikv::coprocessor;
use tikv::coprocessor::codec::table;
use tikv::util::codec::number::NumberEncoder;
use tikv_util::codec::number::NumberEncoder;

#[derive(Clone)]
pub struct Table {
Expand Down
1 change: 1 addition & 0 deletions components/test_raftstore/Cargo.toml
Expand Up @@ -5,6 +5,7 @@ edition = "2018"
publish = false

[dependencies]
tikv_util = { path = "../tikv_util" }
tikv = { path = "../../", default-features = false }
kvproto = { git = "https://github.com/pingcap/kvproto.git" }
protobuf = "~2.0"
Expand Down
4 changes: 2 additions & 2 deletions components/test_raftstore/src/cluster.rs
Expand Up @@ -23,8 +23,8 @@ use tikv::raftstore::store::fsm::{create_raft_batch_system, RaftBatchSystem, Raf
use tikv::raftstore::store::*;
use tikv::raftstore::{Error, Result};
use tikv::server::Result as ServerResult;
use tikv::util::collections::{HashMap, HashSet};
use tikv::util::{escape, HandyRwLock};
use tikv_util::collections::{HashMap, HashSet};
use tikv_util::{escape, HandyRwLock};

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion components/test_raftstore/src/lib.rs
Expand Up @@ -14,7 +14,7 @@ extern crate slog;
#[macro_use]
extern crate slog_global;
#[macro_use]
extern crate tikv;
extern crate tikv_util;

mod cluster;
mod node;
Expand Down
4 changes: 2 additions & 2 deletions components/test_raftstore/src/node.rs
Expand Up @@ -21,8 +21,8 @@ use tikv::raftstore::Result;
use tikv::server::transport::{RaftStoreRouter, ServerRaftStoreRouter};
use tikv::server::Node;
use tikv::server::Result as ServerResult;
use tikv::util::collections::{HashMap, HashSet};
use tikv::util::worker::{FutureWorker, Worker};
use tikv_util::collections::{HashMap, HashSet};
use tikv_util::worker::{FutureWorker, Worker};

use super::*;

Expand Down
6 changes: 3 additions & 3 deletions components/test_raftstore/src/pd.rs
Expand Up @@ -18,9 +18,9 @@ use raft::eraftpb;
use tikv::pd::{Error, Key, PdClient, PdFuture, RegionStat, Result};
use tikv::raftstore::store::keys::{self, data_key, enc_end_key, enc_start_key};
use tikv::raftstore::store::util::check_key_in_region;
use tikv::util::collections::{HashMap, HashMapEntry, HashSet};
use tikv::util::timer::GLOBAL_TIMER_HANDLE;
use tikv::util::{escape, Either, HandyRwLock};
use tikv_util::collections::{HashMap, HashMapEntry, HashSet};
use tikv_util::timer::GLOBAL_TIMER_HANDLE;
use tikv_util::{escape, Either, HandyRwLock};

use super::*;

Expand Down
6 changes: 3 additions & 3 deletions components/test_raftstore/src/server.rs
Expand Up @@ -29,9 +29,9 @@ use tikv::server::{
ServerTransport,
};
use tikv::storage::{self, RaftKv};
use tikv::util::collections::{HashMap, HashSet};
use tikv::util::security::SecurityManager;
use tikv::util::worker::{FutureWorker, Worker};
use tikv_util::collections::{HashMap, HashSet};
use tikv_util::security::SecurityManager;
use tikv_util::worker::{FutureWorker, Worker};

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions components/test_raftstore/src/transport_simulate.rs
Expand Up @@ -16,8 +16,8 @@ use raft::eraftpb::MessageType;
use tikv::raftstore::store::{Callback, CasualMessage, SignificantMsg, Transport};
use tikv::raftstore::{DiscardReason, Error, Result};
use tikv::server::transport::*;
use tikv::util::collections::{HashMap, HashSet};
use tikv::util::{Either, HandyRwLock};
use tikv_util::collections::{HashMap, HashSet};
use tikv_util::{Either, HandyRwLock};

pub fn check_messages(msgs: &[RaftMessage]) -> Result<()> {
if msgs.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions components/test_raftstore/src/util.rs
Expand Up @@ -25,8 +25,8 @@ use tikv::raftstore::Result;
use tikv::server::Config as ServerConfig;
use tikv::storage::kv::CompactionListener;
use tikv::storage::Config as StorageConfig;
use tikv::util::config::*;
use tikv::util::escape;
use tikv_util::config::*;
use tikv_util::escape;

use super::*;

Expand Down
1 change: 1 addition & 0 deletions components/test_storage/Cargo.toml
Expand Up @@ -5,6 +5,7 @@ edition = "2018"
publish = false

[dependencies]
tikv_util = { path = "../tikv_util" }
tikv = { path = "../../", default-features = false }
test_raftstore = { path = "../test_raftstore" }
kvproto = { git = "https://github.com/pingcap/kvproto.git" }
Expand Down
2 changes: 1 addition & 1 deletion components/test_storage/src/assert_storage.rs
Expand Up @@ -7,7 +7,7 @@ use tikv::storage::kv::{self, RocksEngine};
use tikv::storage::mvcc::{self, MAX_TXN_WRITE_SIZE};
use tikv::storage::txn;
use tikv::storage::{self, Engine, Key, KvPair, Mutation, Value};
use tikv::util::HandyRwLock;
use tikv_util::HandyRwLock;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion components/test_storage/src/lib.rs
@@ -1,7 +1,7 @@
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.

#[macro_use]
extern crate tikv;
extern crate tikv_util;

mod assert_storage;
mod sync_storage;
Expand Down
2 changes: 1 addition & 1 deletion components/test_storage/src/sync_storage.rs
Expand Up @@ -10,7 +10,7 @@ use tikv::storage::{
Result, Storage, Value,
};
use tikv::storage::{TestEngineBuilder, TestStorageBuilder};
use tikv::util::collections::HashMap;
use tikv_util::collections::HashMap;

/// A builder to build a `SyncTestStorage`.
///
Expand Down
2 changes: 1 addition & 1 deletion components/test_storage/src/util.rs
Expand Up @@ -3,7 +3,7 @@
use kvproto::kvrpcpb::Context;

use test_raftstore::{new_server_cluster, Cluster, ServerCluster, SimulateEngine};
use tikv::util::HandyRwLock;
use tikv_util::HandyRwLock;

use super::*;

Expand Down
3 changes: 2 additions & 1 deletion components/test_util/Cargo.toml
Expand Up @@ -5,7 +5,8 @@ edition = "2018"
publish = false

[dependencies]
tikv = { path = "../../", default-features = false }
tikv_util = { path = "../tikv_util" }
brson marked this conversation as resolved.
Show resolved Hide resolved
tikv_alloc = { path = "../tikv_alloc", default-features = false }
time = "0.1"
rand = "0.5"
slog = { version = "2.3", features = ["max_level_trace", "release_max_level_debug"] }
4 changes: 2 additions & 2 deletions components/test_util/src/lib.rs
Expand Up @@ -37,8 +37,8 @@ pub fn setup_for_ci() {
if env::var("PANIC_ABORT").is_ok() {
// Panics as aborts, it's helpful for debugging,
// but also stops tests immediately.
tikv::util::set_panic_hook(true, "./");
tikv_util::set_panic_hook(true, "./");
}

tikv::util::check_environment_variables();
tikv_util::check_environment_variables();
}