DatabaseSource::Auto (#9500)

* implement "auto" database backend in client/db, in progress, #9201

* move fn supports_ref_counting from DatabaseSource enum to Database trait to make it work correctly for all types of dbs

* update kvdb_rocksdb to 0.13 and use it's new config feature  to properly auto start existing database

* tests for auto database reopening

* introduce OpenDbError to cleanup opening database error handling and handle case when database is not enabled at the compile time

* cargo fmt strings again

* cargo fmt strings again

* rename DataSettingsSrc to fix test compilation

* fix the call to the new kvdb-rocksdb interdace in tests to fix compilation

* simplify OpenDbError and make it compile even when paritydb and rocksdb are disabled

* cargo fmt

* fix compilation without flag with-parity-db

* fix unused var compilation warning

* support different paths for rocksdb and paritydb in DatabaseSouce::Auto

* support "auto" database option in substrate cli

* enable Lz4 compression for some of the parity-db colums as per review suggestion

* applied review suggestions
This commit is contained in:
Marek Kotewicz
2021-08-09 15:22:28 +02:00
committed by GitHub
parent 4dc8db2b80
commit a2f7524138
21 changed files with 549 additions and 219 deletions
+1 -1
View File
@@ -42,7 +42,7 @@
//! use sc_finality_grandpa::GrandpaBlockImport;
//! use sc_service::{
//! TFullBackend, TFullClient, Configuration, TaskManager, new_full_parts, BasePath,
//! DatabaseConfig, KeepBlocks, TransactionStorageMode, ChainSpec, Role,
//! DatabaseSource, KeepBlocks, TransactionStorageMode, ChainSpec, Role,
//! config::{NetworkConfiguration, KeystoreConfig},
//! };
//! use std::sync::Arc;
@@ -25,7 +25,7 @@ use sc_network::{
multiaddr,
};
use sc_service::{
config::KeystoreConfig, BasePath, ChainSpec, Configuration, DatabaseConfig, KeepBlocks,
config::KeystoreConfig, BasePath, ChainSpec, Configuration, DatabaseSource, KeepBlocks,
TaskExecutor, TaskType, TransactionStorageMode,
};
use sp_keyring::sr25519::Keyring::Alice;
@@ -79,7 +79,7 @@ pub fn default_config(
transaction_pool: Default::default(),
network: network_config,
keystore: KeystoreConfig::Path { path: root_path.join("key"), password: None },
database: DatabaseConfig::RocksDb { path: root_path.join("db"), cache_size: 128 },
database: DatabaseSource::RocksDb { path: root_path.join("db"), cache_size: 128 },
state_cache_size: 16777216,
state_cache_child_ratio: None,
chain_spec,