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

[DRAFT] feat: Default to LMDB backend on macOS #3876

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, you can switch to the old one using the `--rocksdb` flag on
`dfx start`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a discussion on https://github.com/dfinity/sdk/discussions and link to it here (if developers are encountering problems, we want to hear about it)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done.


### feat: Add canister snapshots

The new `dfx canister snapshot` command can be used to create, apply, and delete snapshots of stopped canisters.
Expand Down
1 change: 1 addition & 0 deletions docs/cli-reference/dfx-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/dfx-core/src/config/model/replica_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -62,6 +63,7 @@ impl ReplicaConfig {
subnet_type: ReplicaSubnetType,
log_level: ReplicaLogLevel,
artificial_delay: u32,
use_rocksdb: bool,
) -> Self {
ReplicaConfig {
http_handler: HttpHandlerConfig {
Expand All @@ -88,6 +90,7 @@ impl ReplicaConfig {
},
log_level,
artificial_delay,
use_rocksdb,
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/dfx/src/actors/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()]);
}
Expand Down
14 changes: 12 additions & 2 deletions src/dfx/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -146,6 +150,7 @@ pub fn exec(
artificial_delay,
domain,
pocketic,
rocksdb,
}: StartOpts,
) -> DfxResult {
if !background {
Expand Down Expand Up @@ -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 {
Expand Down
Loading