Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove rocksdb #3048

Merged
merged 9 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

### Breaking

- [#3048](https://github.com/ChainSafe/forest/pull/3048): Remove support for
rocksdb

### Added

- [#2816](https://github.com/ChainSafe/forest/issues/2816): Support `2k` devnet.
Expand Down
106 changes: 0 additions & 106 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ num-rational = "0.4"
num-traits = "0.2"
num_cpus = "1.14"
once_cell = "1.15"
parity-db = { version = "0.4.6", optional = true, default_features = false }
parity-db = { version = "0.4.6", default_features = false }
parking_lot = "0.12"
pbr = "1.1"
pin-project-lite = "0.2"
Expand All @@ -146,9 +146,6 @@ reqwest = { version = "0.11.18", default-features = false, features = [
"stream",
"rustls-tls",
] } # use rustls instead of native (openSSL) tls to drop the number of build dependencies
rocksdb = { version = "0.20", optional = true, default_features = false, features = [
"lz4",
] } # only opt in to the compression we use, see #2227
rustyline = "10.1.1"
semver = "1.0"
serde = { version = "1.0", default-features = false, features = ["derive"] }
Expand Down Expand Up @@ -222,19 +219,15 @@ overflow-checks = true

# These should be refactored (probably removed) in #2984
[features]
default = ["paritydb", "jemalloc", "fil_cns"]
default = ["jemalloc", "fil_cns"]
instrumented_kernel = ["dep:stdext"]
insecure_post = []
doctest-private = [] # see lib.rs::doctest_private
benchmark-private = [] # see lib.rs::benchmark_private

# Databases
paritydb = ["dep:parity-db"]
rocksdb = ["dep:rocksdb"]
doctest-private = [] # see lib.rs::doctest_private
benchmark-private = [] # see lib.rs::benchmark_private

# Allocator
rustalloc = []
jemalloc = ["dep:tikv-jemallocator", "rocksdb?/jemalloc"]
jemalloc = ["dep:tikv-jemallocator"]
mimalloc = ["dep:mimalloc"]

# Consensus
Expand Down
23 changes: 4 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@ install-daemon:
install:
cargo install --locked --path . --force

# Installs Forest binaries with RocksDb backend
install-with-rocksdb:
cargo install --locked --path . --force --no-default-features --features jemalloc,rocksdb,fil_cns

# Installs Forest binaries with default rust global allocator
install-with-rustalloc:
cargo install --locked --path . --force --no-default-features --features rustalloc,paritydb,fil_cns
cargo install --locked --path . --force --no-default-features --features rustalloc,fil_cns

# Installs Forest binaries with MiMalloc global allocator
install-with-mimalloc:
cargo install --locked --path . --force --no-default-features --features mimalloc,paritydb,fil_cns
cargo install --locked --path . --force --no-default-features --features mimalloc,fil_cns

install-deps:
apt-get update -y
Expand Down Expand Up @@ -79,12 +75,9 @@ lint-clippy:
cargo clippy --features=instrumented_kernel --quiet --no-deps -- --deny=warnings

# different consensus algos (repeated for clarity)
cargo clippy --features=paritydb,rustalloc,fil_cns --no-default-features --quiet --no-deps -- --deny=warnings
cargo clippy --features=paritydb,rustalloc,deleg_cns --no-default-features --quiet --no-deps -- --deny=warnings
cargo clippy --features=rustalloc,fil_cns --no-default-features --quiet --no-deps -- --deny=warnings
cargo clippy --features=rustalloc,deleg_cns --no-default-features --quiet --no-deps -- --deny=warnings

# different databases (repeated for clarity)
cargo clippy --features=paritydb,rustalloc,fil_cns --no-default-features --quiet --no-deps -- --deny=warnings
cargo clippy --features=rocksdb,rustalloc,fil_cns --no-default-features --quiet --no-deps -- --deny=warnings

DOCKERFILES=$(wildcard Dockerfile*)
lint-docker: $(DOCKERFILES)
Expand All @@ -108,21 +101,13 @@ docker-run:
test:
cargo nextest run

# different databases (repeated for clarity)
cargo nextest run --features=paritydb,rustalloc,fil_cns --no-default-features db
cargo nextest run --features=rocksdb,rustalloc,fil_cns --no-default-features db

# nextest doesn't run doctests https://github.com/nextest-rs/nextest/issues/16
# see also lib.rs::doctest_private
cargo test --doc --features doctest-private

test-release:
cargo nextest run --release

# different databases (repeated for clarity)
cargo nextest run --release --features=paritydb,rustalloc,fil_cns --no-default-features db
cargo nextest run --release --features=rocksdb,rustalloc,fil_cns --no-default-features db

test-all: test test-release

smoke-test:
Expand Down
7 changes: 0 additions & 7 deletions documentation/src/trouble_shooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

## Common Issues

#### File Descriptor Limits

By default, Forest will use large database files (roughly 1GiB each). Lowering
the size of these files lets RocksDB use less memory but runs the risk of
hitting the open-files limit. If you do hit this limit, either increase the file
size or use `ulimit` to increase the open-files limit.

#### Jemalloc issues on Apple Silicon macs

Forest is compiled with `jemalloc` as a default allocator. If you are having
Expand Down
6 changes: 0 additions & 6 deletions src/chain_sync/tipset_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,12 +1197,6 @@ async fn validate_tipset<DB: Blockstore + Clone + Send + Sync + 'static, C: Cons
}
}
}
// Doing flush here creates small sst files at ~20KB
// Then we need to manually compact them by calling CompactFiles
// which however is not exposed by rocksdb or librocksdb-sys crate::chain_syncs
// if let Err(e) = chainstore.db.flush() {
// warn!("Failed to flush db: {e}");
// }
Ok(())
}

Expand Down
29 changes: 2 additions & 27 deletions src/cli_shared/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use core::time::Duration;
use std::{path::PathBuf, sync::Arc};

use crate::chain_sync::SyncConfig;
#[cfg(any(feature = "paritydb", feature = "rocksdb"))]
use crate::db::db_engine::DbConfig;
use crate::libp2p::Libp2pConfig;
use crate::networks::ChainConfig;
Expand Down Expand Up @@ -100,7 +99,6 @@ pub struct TokioConfig {
#[serde(default)]
pub struct Config {
pub client: Client,
pub rocks_db: crate::db::rocks_config::RocksDbConfig,
pub parity_db: crate::db::parity_db_config::ParityDbConfig,
pub network: Libp2pConfig,
pub sync: SyncConfig,
Expand All @@ -111,16 +109,8 @@ pub struct Config {
}

impl Config {
cfg_if::cfg_if! {
if #[cfg(feature = "rocksdb")] {
pub fn db_config(&self) -> &DbConfig {
&self.rocks_db
}
} else if #[cfg(feature = "paritydb")] {
pub fn db_config(&self) -> &DbConfig {
&self.parity_db
}
}
pub fn db_config(&self) -> &DbConfig {
&self.parity_db
}
}

Expand All @@ -145,7 +135,6 @@ mod test {
#[derive(Clone, Debug)]
struct ConfigPartial {
client: Client,
rocks_db: crate::db::rocks_config::RocksDbConfig,
parity_db: crate::db::parity_db_config::ParityDbConfig,
network: crate::libp2p::Libp2pConfig,
sync: crate::chain_sync::SyncConfig,
Expand All @@ -155,7 +144,6 @@ mod test {
fn from(val: ConfigPartial) -> Self {
Config {
client: val.client,
rocks_db: val.rocks_db,
parity_db: val.parity_db,
network: val.network,
sync: val.sync,
Expand Down Expand Up @@ -185,19 +173,6 @@ mod test {
token_exp: Duration::milliseconds(i64::arbitrary(g)),
show_progress_bars: ProgressBarVisibility::arbitrary(g),
},
rocks_db: crate::db::rocks_config::RocksDbConfig {
create_if_missing: bool::arbitrary(g),
parallelism: i32::arbitrary(g),
write_buffer_size: u32::arbitrary(g) as _,
max_open_files: i32::arbitrary(g),
max_background_jobs: Option::arbitrary(g),
compaction_style: String::arbitrary(g),
enable_statistics: bool::arbitrary(g),
stats_dump_period_sec: u32::arbitrary(g),
log_level: String::arbitrary(g),
optimize_filters_for_hits: bool::arbitrary(g),
optimize_for_point_lookup: i32::arbitrary(g),
},
parity_db: crate::db::parity_db_config::ParityDbConfig {
enable_statistics: bool::arbitrary(g),
compression_type: String::arbitrary(g),
Expand Down
Loading