diff --git a/CHANGELOG.md b/CHANGELOG.md index 91cfa7eab4..5189389cf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ # UNRELEASED +### feat: Default to LMDB backend on macOS + +MacOS builds of dfx now use the LMDB artifact pool backend by default. If you encounter any +issues with the new backend, please let us know here: https://github.com/dfinity/sdk/discussions/3880. +You'll still be able to switch to the old backend using the `--rocksdb` flag on `dfx start`. + ### feat: Add canister snapshots The new `dfx canister snapshot` command can be used to create, apply, and delete snapshots of stopped canisters. diff --git a/docs/cli-reference/dfx-start.mdx b/docs/cli-reference/dfx-start.mdx index 515400c796..a1a22b54c0 100644 --- a/docs/cli-reference/dfx-start.mdx +++ b/docs/cli-reference/dfx-start.mdx @@ -25,6 +25,7 @@ You can use the following optional flags with the `dfx start` command. | `--enable-bitcoin` | Enables bitcoin integration. | | `--enable-canister-http` | Enables canister HTTP requests. (deprecated: now enabled by default) | | `--pocketic` | Runs [PocketIC](https://github.com/dfinity/pocketic) instead of the replica. | +| `--rocksdb` | (MacOS only) Enables the old RocksDB artifact pool backend. We recently switched the default artifact pool on macOS to LMDB. If you encounter issues with newer versions of dfx, consider switching to the rocksdb backend. | ## Options diff --git a/src/dfx-core/src/config/model/replica_config.rs b/src/dfx-core/src/config/model/replica_config.rs index dc8f88c100..faa31f45c5 100644 --- a/src/dfx-core/src/config/model/replica_config.rs +++ b/src/dfx-core/src/config/model/replica_config.rs @@ -54,6 +54,7 @@ pub struct ReplicaConfig { pub canister_http_adapter: CanisterHttpAdapterConfig, pub log_level: ReplicaLogLevel, pub artificial_delay: u32, + pub use_rocksdb: bool, } impl ReplicaConfig { @@ -62,6 +63,7 @@ impl ReplicaConfig { subnet_type: ReplicaSubnetType, log_level: ReplicaLogLevel, artificial_delay: u32, + use_rocksdb: bool, ) -> Self { ReplicaConfig { http_handler: HttpHandlerConfig { @@ -88,6 +90,7 @@ impl ReplicaConfig { }, log_level, artificial_delay, + use_rocksdb, } } diff --git a/src/dfx/src/actors/replica.rs b/src/dfx/src/actors/replica.rs index be4321f5aa..b4e042137d 100644 --- a/src/dfx/src/actors/replica.rs +++ b/src/dfx/src/actors/replica.rs @@ -329,8 +329,10 @@ fn replica_start_thread( &config.log_level.as_ic_starter_string(), "--use-specified-ids-allocation-range", ]); - #[cfg(target_os = "macos")] - cmd.args(["--consensus-pool-backend", "rocksdb"]); + if config.use_rocksdb { + #[cfg(target_os = "macos")] + cmd.args(["--consensus-pool-backend", "rocksdb"]); + } if let Some(port) = port { cmd.args(["--http-port", &port.to_string()]); } diff --git a/src/dfx/src/commands/start.rs b/src/dfx/src/commands/start.rs index fa9d491925..70dc296436 100644 --- a/src/dfx/src/commands/start.rs +++ b/src/dfx/src/commands/start.rs @@ -80,6 +80,10 @@ pub struct StartOpts { /// Runs PocketIC instead of the replica #[clap(long, alias = "emulator")] pocketic: bool, + + /// Falls back to the previous rocksdb consensus pool backend. Only has an effect on macOS builds. + #[arg(long)] + rocksdb: bool, } // The frontend webserver is brought up by the bg process; thus, the fg process @@ -146,6 +150,7 @@ pub fn exec( artificial_delay, domain, pocketic, + rocksdb, }: StartOpts, ) -> DfxResult { if !background { @@ -296,8 +301,13 @@ pub fn exec( let proxy_domains = local_server_descriptor.proxy.domain.clone().into_vec(); let replica_config = { - let replica_config = - ReplicaConfig::new(&state_root, subnet_type, log_level, artificial_delay); + let replica_config = ReplicaConfig::new( + &state_root, + subnet_type, + log_level, + artificial_delay, + rocksdb, + ); let mut replica_config = if let Some(port) = local_server_descriptor.replica.port { replica_config.with_port(port) } else {