Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
revert change to rocksdb inclusion logic
Browse files Browse the repository at this point in the history
  • Loading branch information
cheme committed Nov 8, 2022
1 parent 4149006 commit 9ae4139
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bin/node/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ array-bytes = "4.1"
clap = { version = "4.0.9", features = ["derive"] }
log = "0.4.17"
node-primitives = { version = "2.0.0", path = "../primitives" }
node-testing = { version = "3.0.0-dev", features = ["rocksdb"], path = "../testing" }
node-testing = { version = "3.0.0-dev", path = "../testing" }
kitchensink-runtime = { version = "3.0.0-dev", path = "../runtime" }
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api/" }
sp-runtime = { version = "6.0.0", path = "../../../primitives/runtime" }
Expand Down
6 changes: 2 additions & 4 deletions bin/node/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ pallet-asset-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transa
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
sc-block-builder = { version = "0.10.0-dev", path = "../../../client/block-builder" }
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" }
sc-client-db = { version = "0.10.0-dev", features = [], path = "../../../client/db" }
sc-client-db = { version = "0.10.0-dev", features = ["rocksdb"], path = "../../../client/db" }
sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/common" }
sc-executor = { version = "0.10.0-dev", features = [
"wasmtime",
], path = "../../../client/executor" }
sc-service = { version = "0.10.0-dev", features = [
"test-helpers",
"rocksdb",
], path = "../../../client/service" }
sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" }
sp-block-builder = { version = "4.0.0-dev", path = "../../../primitives/block-builder" }
Expand All @@ -45,6 +46,3 @@ sp-keyring = { version = "6.0.0", path = "../../../primitives/keyring" }
sp-runtime = { version = "6.0.0", path = "../../../primitives/runtime" }
sp-timestamp = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/timestamp" }
substrate-test-client = { version = "2.0.0", path = "../../../test-utils/client" }

[features]
rocksdb = ["sc-client-db/rocksdb"]
2 changes: 0 additions & 2 deletions bin/node/testing/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ pub struct BlockContent {
/// Type of backend database.
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum DatabaseType {
#[cfg(feature = "rocksdb")]
/// RocksDb backend.
RocksDb,
/// Parity DB backend.
Expand All @@ -223,7 +222,6 @@ pub enum DatabaseType {
impl DatabaseType {
fn into_settings(self, path: PathBuf) -> sc_client_db::DatabaseSource {
match self {
#[cfg(feature = "rocksdb")]
Self::RocksDb => sc_client_db::DatabaseSource::RocksDb { path, cache_size: 512 },
Self::ParityDb => sc_client_db::DatabaseSource::ParityDb { path },
}
Expand Down
1 change: 1 addition & 0 deletions client/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sp-trie = { version = "6.0.0", path = "../../primitives/trie" }

[dev-dependencies]
criterion = "0.3.3"
kvdb-rocksdb = "0.16.0"
rand = "0.8.4"
tempfile = "3.1.0"
quickcheck = { version = "1.0.3", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mod children;
mod parity_db;
mod record_stats_state;
mod stats;
#[cfg(feature = "rocksdb")]
#[cfg(any(feature = "rocksdb", test))]
mod upgrade;
mod utils;

Expand Down
10 changes: 3 additions & 7 deletions client/db/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ fn open_parity_db<Block: BlockT>(path: &Path, db_type: DatabaseType, create: boo
}
}

#[cfg(feature = "rocksdb")]
#[cfg(any(feature = "rocksdb", test))]
fn open_kvdb_rocksdb<Block: BlockT>(
path: &Path,
db_type: DatabaseType,
Expand Down Expand Up @@ -343,7 +343,7 @@ fn open_kvdb_rocksdb<Block: BlockT>(
Ok(sp_database::as_database(db))
}

#[cfg(not(feature = "rocksdb"))]
#[cfg(not(any(feature = "rocksdb", test)))]
fn open_kvdb_rocksdb<Block: BlockT>(
_path: &Path,
_db_type: DatabaseType,
Expand Down Expand Up @@ -583,11 +583,10 @@ mod tests {
use super::*;
use codec::Input;
use sp_runtime::testing::{Block as RawBlock, ExtrinsicWrapper};
#[cfg(feature = "rocksdb")]
use std::path::PathBuf;
type Block = RawBlock<ExtrinsicWrapper<u32>>;

#[cfg(feature = "rocksdb")]
#[cfg(any(feature = "rocksdb", test))]
#[test]
fn database_type_subdir_migration() {
type Block = RawBlock<ExtrinsicWrapper<u64>>;
Expand Down Expand Up @@ -686,7 +685,6 @@ mod tests {
assert_eq!(joined.remaining_len().unwrap(), Some(0));
}

#[cfg(feature = "rocksdb")]
#[test]
fn test_open_database_auto_new() {
let db_dir = tempfile::TempDir::new().unwrap();
Expand Down Expand Up @@ -732,7 +730,6 @@ mod tests {
}
}

#[cfg(feature = "rocksdb")]
#[test]
fn test_open_database_rocksdb_new() {
let db_dir = tempfile::TempDir::new().unwrap();
Expand Down Expand Up @@ -805,7 +802,6 @@ mod tests {
}

// it should fail to open existing pairtydb database
#[cfg(feature = "rocksdb")]
{
let db_res = open_database::<Block>(
&DatabaseSource::RocksDb { path: rocksdb_path.clone(), cache_size: 128 },
Expand Down
2 changes: 1 addition & 1 deletion client/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[features]
default = []
default = ["rocksdb"]
# The RocksDB feature activates the RocksDB database backend. If it is not activated, and you pass
# a path to a database, an error will be produced at runtime.
rocksdb = ["sc-client-db/rocksdb"]
Expand Down
3 changes: 0 additions & 3 deletions scripts/ci/gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@ test-linux-stable:
--release
--verbose
--features runtime-benchmarks
--features sc-cli/rocksdb
--features sc-client-db/rocksdb
--features node-testing/rocksdb
--manifest-path ./bin/node/cli/Cargo.toml
--exclude node-cli
--partition count:${CI_NODE_INDEX}/${CI_NODE_TOTAL}
Expand Down

0 comments on commit 9ae4139

Please sign in to comment.