Specify column cache sizes explicitly; default fallback of 2MB (#2358)

* allow specifying cache sizes for specific columns

* initialize client with correct cache size

* set cache size in client service

* default cache size for unspecified columns

* fix comment

* fix column selection logic

* fix migrations module
This commit is contained in:
Robert Habermeier
2016-09-27 18:16:32 +02:00
committed by Gav Wood
parent ad63780b4d
commit fb92a98451
4 changed files with 31 additions and 11 deletions

View File

@@ -80,7 +80,13 @@ impl ClientService {
}
let mut db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
db_config.cache_size = config.db_cache_size;
// give all rocksdb cache to state column; everything else has its
// own caches.
if let Some(size) = config.db_cache_size {
db_config.set_cache(::db::COL_STATE, size);
}
db_config.compaction = config.db_compaction.compaction_profile();
db_config.wal = config.db_wal;
@@ -90,7 +96,7 @@ impl ClientService {
let snapshot_params = SnapServiceParams {
engine: spec.engine.clone(),
genesis_block: spec.genesis_block(),
db_config: db_config,
db_config: db_config.clone(),
pruning: pruning,
channel: io_service.channel(),
snapshot_root: snapshot_path.into(),