Skip to content

Commit

Permalink
s/DEFAULT_ENGINE_CFS/DEFAULT_CFS/
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing committed Jun 29, 2016
1 parent a0582aa commit a59c809
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
4 changes: 2 additions & 2 deletions benches/bin/mvcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use test::BenchSamples;
use tempdir::TempDir;

use test_util::*;
use tikv::storage::{self, Dsn, Mutation, Key, DEFAULT_ENGINE_CFS};
use tikv::storage::{self, Dsn, Mutation, Key, DEFAULT_CFS};
use tikv::storage::txn::TxnStore;
use tikv::storage::mvcc::TEST_TS_BASE;
use kvproto::kvrpcpb::Context;
Expand All @@ -26,7 +26,7 @@ use super::print_result;
/// In mvcc kv is not actually deleted, which may cause performance issue
/// when doing scan.
fn bench_tombstone_scan(dsn: Dsn) -> BenchSamples {
let engine = storage::new_engine(dsn, DEFAULT_ENGINE_CFS).unwrap();
let engine = storage::new_engine(dsn, DEFAULT_CFS).unwrap();

let store = TxnStore::new(Arc::new(engine));
let mut ts_generator = TEST_TS_BASE..;
Expand Down
4 changes: 2 additions & 2 deletions src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub use self::types::{Key, Value, KvPair};
pub type Callback<T> = Box<FnBox(Result<T>) + Send>;

pub type CfName = &'static str;
pub const DEFAULT_ENGINE_CFS: &'static [CfName] = &[];
pub const DEFAULT_CFS: &'static [CfName] = &[];

#[cfg(test)]
pub use self::types::make_key;
Expand Down Expand Up @@ -188,7 +188,7 @@ impl Storage {
}

pub fn new(dsn: Dsn) -> Result<Storage> {
let engine = try!(engine::new_engine(dsn, DEFAULT_ENGINE_CFS));
let engine = try!(engine::new_engine(dsn, DEFAULT_CFS));
Storage::from_engine(engine)
}

Expand Down
20 changes: 10 additions & 10 deletions src/storage/mvcc/txn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,13 @@ impl<'a> MvccCursor<'a> {
mod tests {
use kvproto::kvrpcpb::Context;
use super::MvccTxn;
use storage::{make_key, Mutation, DEFAULT_ENGINE_CFS};
use storage::{make_key, Mutation, DEFAULT_CFS};
use storage::engine::{self, Engine, Dsn, TEMP_DIR};
use storage::mvcc::TEST_TS_BASE;

#[test]
fn test_mvcc_txn_read() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();

must_get_none(engine.as_ref(), b"x", 1);

Expand Down Expand Up @@ -349,7 +349,7 @@ mod tests {

#[test]
fn test_mvcc_txn_prewrite() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();

must_prewrite_put(engine.as_ref(), b"x", b"x5", b"x", 5);
// Key is locked.
Expand All @@ -367,7 +367,7 @@ mod tests {

#[test]
fn test_mvcc_txn_commit_ok() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
must_prewrite_put(engine.as_ref(), b"x", b"x10", b"x", 10);
must_commit(engine.as_ref(), b"x", 10, 15);
// commit should be idempotent
Expand All @@ -376,7 +376,7 @@ mod tests {

#[test]
fn test_mvcc_txn_commit_err() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();

// Not prewrite yet
must_commit_err(engine.as_ref(), b"x", 1, 2);
Expand All @@ -390,7 +390,7 @@ mod tests {

#[test]
fn test_mvcc_txn_commit_then_get() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();

must_prewrite_put(engine.as_ref(), b"x", b"x5", b"x", 5);
must_commit_then_get(engine.as_ref(), b"x", 5, 10, 15, b"x5");
Expand All @@ -400,7 +400,7 @@ mod tests {

#[test]
fn test_mvcc_txn_rollback() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();

must_prewrite_put(engine.as_ref(), b"x", b"x5", b"x", 5);
must_rollback(engine.as_ref(), b"x", 5);
Expand All @@ -415,7 +415,7 @@ mod tests {

#[test]
fn test_mvcc_txn_rollback_err() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();

must_prewrite_put(engine.as_ref(), b"x", b"x5", b"x", 5);
must_commit(engine.as_ref(), b"x", 5, 10);
Expand All @@ -424,7 +424,7 @@ mod tests {

#[test]
fn test_mvcc_txn_rollback_then_get() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();

must_prewrite_put(engine.as_ref(), b"x", b"x5", b"x", 5);
must_commit(engine.as_ref(), b"x", 5, 10);
Expand All @@ -440,7 +440,7 @@ mod tests {

#[test]
fn test_mvcc_txn_meta_split() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
for i in 1u64..300 {
let val = format!("x{}", i);
must_prewrite_put(engine.as_ref(), b"x", val.as_bytes(), b"x", 5 * i);
Expand Down
22 changes: 11 additions & 11 deletions src/storage/txn/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl<'a> StoreScanner<'a> {
mod tests {
use super::*;
use kvproto::kvrpcpb::Context;
use storage::{Mutation, Key, KvPair, make_key, DEFAULT_ENGINE_CFS};
use storage::{Mutation, Key, KvPair, make_key, DEFAULT_CFS};
use storage::engine::{self, Dsn, TEMP_DIR};
use storage::mvcc::TEST_TS_BASE;

Expand Down Expand Up @@ -466,7 +466,7 @@ mod tests {

#[test]
fn test_txn_store_get() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));

// not exist
Expand All @@ -480,7 +480,7 @@ mod tests {

#[test]
fn test_txn_store_delete() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));

store.put_ok(b"x", b"x5-10", 5, 10);
Expand All @@ -495,7 +495,7 @@ mod tests {

#[test]
fn test_txn_store_cleanup_rollback() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));

store.put_ok(b"secondary", b"s-0", 1, 2);
Expand All @@ -511,7 +511,7 @@ mod tests {

#[test]
fn test_txn_store_cleanup_commit() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));

store.put_ok(b"secondary", b"s-0", 1, 2);
Expand All @@ -531,7 +531,7 @@ mod tests {

#[test]
fn test_txn_store_scan() {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));

// ver10: A(10) - B(_) - C(10) - D(_) - E(10)
Expand Down Expand Up @@ -758,7 +758,7 @@ mod tests {
const THREAD_NUM: usize = 4;
const INC_PER_THREAD: usize = 100;

let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = Arc::new(TxnStore::new(Arc::new(engine)));
let oracle = Arc::new(Oracle::new());
let punch_card = Arc::new(Mutex::new(vec![false; THREAD_NUM * INC_PER_THREAD]));
Expand Down Expand Up @@ -835,7 +835,7 @@ mod tests {
const KEY_NUM: usize = 4;
const INC_PER_THREAD: usize = 100;

let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = Arc::new(TxnStore::new(Arc::new(engine)));
let oracle = Arc::new(Oracle::new());

Expand All @@ -861,7 +861,7 @@ mod tests {

#[bench]
fn bench_txn_store_rocksdb_inc(b: &mut Bencher) {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));
let oracle = Oracle::new();

Expand All @@ -872,7 +872,7 @@ mod tests {

#[bench]
fn bench_txn_store_rocksdb_inc_x100(b: &mut Bencher) {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));
let oracle = Oracle::new();

Expand All @@ -883,7 +883,7 @@ mod tests {

#[bench]
fn bench_txn_store_rocksdb_put_x100(b: &mut Bencher) {
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS).unwrap();
let engine = engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap();
let store = TxnStore::new(Arc::new(engine));
let oracle = Oracle::new();

Expand Down
5 changes: 2 additions & 3 deletions tests/coprocessor/test_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use kvproto::kvrpcpb::Context;
use tikv::util::codec::{table, Datum, datum};
use tikv::util::codec::datum::DatumDecoder;
use tikv::util::codec::number::*;
use tikv::storage::{Dsn, Mutation, Key, DEFAULT_ENGINE_CFS};
use tikv::storage::{Dsn, Mutation, Key, DEFAULT_CFS};
use tikv::storage::engine::{self, Engine, TEMP_DIR};
use tikv::storage::txn::TxnStore;
use tikv::util::event::Event;
Expand Down Expand Up @@ -220,8 +220,7 @@ fn prepare_sel(store: &mut Store,
// `varchar$((handle / 2))`. Third column's type is long, id is 4,
// value is the same as handle.
fn initial_data(count: i64) -> (Store, Worker<RequestTask>, TableInfo) {
let engine = Arc::new(engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_ENGINE_CFS)
.unwrap());
let engine = Arc::new(engine::new_engine(Dsn::RocksDBPath(TEMP_DIR), DEFAULT_CFS).unwrap());
let mut store = Store::new(engine.clone());
let ti = TableInfo {
t_id: 1,
Expand Down

0 comments on commit a59c809

Please sign in to comment.