Store the database in a role specific subdirectory (#9645)

* Store the database in a role specific subdirectory

This is a cleaned up version of #8658 fixing #6880

polkadot companion: paritytech/polkadot#2923

* Disable prometheus in tests

* Also change p2p port

* Fix migration logic

* Use different identification file for rocks and parity db

Add tests for paritydb migration
This commit is contained in:
Falco Hirschenberger
2021-09-07 15:31:25 +02:00
committed by GitHub
parent 4849e34270
commit 16144e7404
12 changed files with 317 additions and 24 deletions
+8 -3
View File
@@ -219,9 +219,14 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
base_path: &PathBuf,
cache_size: usize,
database: Database,
role: &Role,
) -> Result<DatabaseSource> {
let rocksdb_path = base_path.join("db");
let paritydb_path = base_path.join("paritydb");
let role_dir = match role {
Role::Light => "light",
Role::Full | Role::Authority => "full",
};
let rocksdb_path = base_path.join("db").join(role_dir);
let paritydb_path = base_path.join("paritydb").join(role_dir);
Ok(match database {
Database::RocksDb => DatabaseSource::RocksDb { path: rocksdb_path, cache_size },
Database::ParityDb => DatabaseSource::ParityDb { path: rocksdb_path },
@@ -499,7 +504,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
)?,
keystore_remote,
keystore,
database: self.database_config(&config_dir, database_cache_size, database)?,
database: self.database_config(&config_dir, database_cache_size, database, &role)?,
state_cache_size: self.state_cache_size()?,
state_cache_child_ratio: self.state_cache_child_ratio()?,
state_pruning: self.state_pruning(unsafe_pruning, &role)?,