Skip to content
Draft
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
1 change: 1 addition & 0 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ Client implementation and command-line tool for the Linera blockchain
* `--storage-replication-factor <STORAGE_REPLICATION_FACTOR>` — The replication factor for the keyspace

Default value: `1`
* `--rocksdb-opt <KEY=VALUE>` — Extra RocksDB tuning options, passed as repeated `KEY=VALUE` pairs, e.g. `--rocksdb-opt write_buffer_size=268435456 --rocksdb-opt max_open_files=512`. Can also be set via the `LINERA_ROCKSDB_OPTS` environment variable as a comma-separated list. These only affect runtime behavior, never the on-disk storage format; format-defining keys are rejected. Run with an unknown key to see the list of supported options
* `--wasm-runtime <WASM_RUNTIME>` — The WebAssembly runtime to use
* `--with-application-logs` — Output log messages from contract execution
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
Expand Down
1 change: 1 addition & 0 deletions linera-bridge/src/relay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ async fn create_rocksdb_storage(
path_with_guard: PathWithGuard::new(path.to_path_buf()),
spawn_mode: RocksDbSpawnMode::get_spawn_mode_from_runtime(),
max_stream_queries: 10,
tuning_options: Default::default(),
},
storage_cache_config: StorageCacheConfig {
max_cache_size: 10_000_000,
Expand Down
1 change: 1 addition & 0 deletions linera-indexer/lib/src/rocks_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl RocksDbRunner {
spawn_mode,
path_with_guard,
max_stream_queries: config.client.max_stream_queries,
tuning_options: Default::default(),
};
let store_config = RocksDbStoreConfig {
inner_config,
Expand Down
1 change: 1 addition & 0 deletions linera-indexer/lib/src/scylla_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl ScyllaDbRunner {
max_stream_queries: config.client.max_stream_queries,
max_concurrent_queries: config.client.max_concurrent_queries,
replication_factor: config.client.replication_factor,
tuning_options: Default::default(),
};
let store_config = ScyllaDbStoreConfig {
inner_config,
Expand Down
32 changes: 32 additions & 0 deletions linera-storage-runtime/src/common_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,38 @@ pub struct CommonStorageOptions {
/// The replication factor for the keyspace
#[arg(long, default_value = "1", global = true)]
pub storage_replication_factor: u32,

/// Extra RocksDB tuning options, passed as repeated `KEY=VALUE` pairs, e.g.
/// `--rocksdb-opt write_buffer_size=268435456 --rocksdb-opt max_open_files=512`.
/// Can also be set via the `LINERA_ROCKSDB_OPTS` environment variable as a
/// comma-separated list. These only affect runtime behavior, never the
/// on-disk storage format; format-defining keys are rejected. Run with an
/// unknown key to see the list of supported options.
#[cfg(feature = "rocksdb")]
#[arg(
long = "rocksdb-opt",
value_name = "KEY=VALUE",
env = "LINERA_ROCKSDB_OPTS",
value_delimiter = ',',
global = true
)]
pub rocksdb_opts: Vec<String>,

/// Extra ScyllaDB driver options, passed as repeated `KEY=VALUE` pairs, e.g.
/// `--scylladb-opt consistency=local_quorum --scylladb-opt request_timeout_ms=5000`.
/// Can also be set via the `LINERA_SCYLLADB_OPTS` environment variable as a
/// comma-separated list. These only affect the driver/session behavior, never
/// the on-disk storage format or table schema. Run with an unknown key to see
/// the list of supported options.
#[cfg(feature = "scylladb")]
#[arg(
long = "scylladb-opt",
value_name = "KEY=VALUE",
env = "LINERA_SCYLLADB_OPTS",
value_delimiter = ',',
global = true
)]
pub scylladb_opts: Vec<String>,
}

impl CommonStorageOptions {
Expand Down
16 changes: 16 additions & 0 deletions linera-storage-runtime/src/storage_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,14 @@ impl StorageConfig {
#[cfg(feature = "rocksdb")]
InnerStorageConfig::RocksDb { path, spawn_mode } => {
let path_with_guard = PathWithGuard::new(path.to_path_buf());
let tuning_options = linera_views::rocks_db::RocksDbTuningOptions::from_kv_pairs(
&options.rocksdb_opts,
)?;
let inner_config = linera_views::rocks_db::RocksDbStoreInternalConfig {
spawn_mode: *spawn_mode,
path_with_guard,
max_stream_queries: options.storage_max_stream_queries,
tuning_options,
};
let config = linera_views::rocks_db::RocksDbStoreConfig {
inner_config,
Expand All @@ -345,11 +349,15 @@ impl StorageConfig {
}
#[cfg(feature = "scylladb")]
InnerStorageConfig::ScyllaDb { uri } => {
let tuning_options = linera_views::scylla_db::ScyllaDbTuningOptions::from_kv_pairs(
&options.scylladb_opts,
)?;
let inner_config = linera_views::scylla_db::ScyllaDbStoreInternalConfig {
uri: uri.clone(),
max_stream_queries: options.storage_max_stream_queries,
max_concurrent_queries: options.storage_max_concurrent_queries,
replication_factor: options.storage_replication_factor,
tuning_options,
};
let config = linera_views::scylla_db::ScyllaDbStoreConfig {
inner_config,
Expand All @@ -363,21 +371,29 @@ impl StorageConfig {
spawn_mode,
uri,
} => {
let tuning_options = linera_views::rocks_db::RocksDbTuningOptions::from_kv_pairs(
&options.rocksdb_opts,
)?;
let inner_config = linera_views::rocks_db::RocksDbStoreInternalConfig {
spawn_mode: *spawn_mode,
path_with_guard: path_with_guard.clone(),
max_stream_queries: options.storage_max_stream_queries,
tuning_options,
};
let first_config = linera_views::rocks_db::RocksDbStoreConfig {
inner_config,
storage_cache_config: options.views_storage_cache_config(),
};

let tuning_options = linera_views::scylla_db::ScyllaDbTuningOptions::from_kv_pairs(
&options.scylladb_opts,
)?;
let inner_config = linera_views::scylla_db::ScyllaDbStoreInternalConfig {
uri: uri.clone(),
max_stream_queries: options.storage_max_stream_queries,
max_concurrent_queries: options.storage_max_concurrent_queries,
replication_factor: options.storage_replication_factor,
tuning_options,
};
let second_config = linera_views::scylla_db::ScyllaDbStoreConfig {
inner_config,
Expand Down
4 changes: 4 additions & 0 deletions linera-storage-runtime/src/store_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ use serde::{Deserialize, Serialize};
use {linera_storage::ChainStatesFirstAssignment, linera_views::backends::dual::DualDatabase};

/// The configuration of the key value store in use.
// The RocksDB / dual variants carry the full backend tuning configuration, which
// is legitimately larger than the other variants. This config is built once at
// startup, so the size disparity is not a concern.
#[allow(clippy::large_enum_variant)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum StoreConfig {
/// The memory key value store
Expand Down
1 change: 1 addition & 0 deletions linera-storage-service/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ async fn main() {
spawn_mode,
path_with_guard,
max_stream_queries,
tuning_options: Default::default(),
};
let storage_cache_config = StorageCacheConfig {
max_cache_size,
Expand Down
Loading
Loading