Switch to new kvdb-rocksdb (#4186)

* Switch to new rocksdb with some hacks to resolve linking errors

Rocksdb and `wasmtime-environ` both link `zstd`. In the final link step,
this leads to linking errors because of duplicate symbols. The linked
Rocksdb fixes this by using `zstd-sys` as well. However, this currently
also requires modifications in `zstd-sys`. Someone will need to come up
with a better implementation.

* Switch to new version of kvdb-rocksdb

* Update client/db/src/utils.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Bastian Köcher
2019-11-23 23:28:42 +01:00
committed by GitHub
parent 1c9316a6c1
commit f0fc2d89d2
8 changed files with 89 additions and 88 deletions
+18 -2
View File
@@ -213,8 +213,24 @@ pub fn open_database(
#[cfg(feature = "kvdb-rocksdb")]
DatabaseSettingsSrc::Path { path, cache_size } => {
let mut db_config = DatabaseConfig::with_columns(Some(NUM_COLUMNS));
db_config.memory_budget = *cache_size;
let path = path.to_str().ok_or_else(|| client::error::Error::Backend("Invalid database path".into()))?;
if let Some(cache_size) = cache_size {
let state_col_budget = (*cache_size as f64 * 0.7) as usize;
let other_col_budget = cache_size - state_col_budget;
let mut memory_budget = std::collections::HashMap::new();
for i in 0..NUM_COLUMNS {
if Some(i) == crate::columns::STATE {
memory_budget.insert(Some(i), state_col_budget);
} else {
memory_budget.insert(Some(i), other_col_budget);
}
}
db_config.memory_budget = memory_budget;
}
let path = path.to_str()
.ok_or_else(|| client::error::Error::Backend("Invalid database path".into()))?;
Arc::new(Database::open(&db_config, &path).map_err(db_err)?)
},
#[cfg(not(feature = "kvdb-rocksdb"))]