Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Refactored block body database scheme #10779

Merged
merged 10 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 5 additions & 5 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion bin/node/testing/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ impl BenchDb {
state_pruning: PruningMode::ArchiveAll,
source: database_type.into_settings(dir.into()),
keep_blocks: sc_client_db::KeepBlocks::All,
transaction_storage: sc_client_db::TransactionStorageMode::BlockBody,
};
let task_executor = TaskExecutor::new();

Expand Down
11 changes: 1 addition & 10 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use sc_service::{
NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods,
TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod,
},
ChainSpec, KeepBlocks, TracingReceiver, TransactionStorageMode,
ChainSpec, KeepBlocks, TracingReceiver,
};
use sc_tracing::logging::LoggerBuilder;
use std::{net::SocketAddr, path::PathBuf};
Expand Down Expand Up @@ -198,14 +198,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
Ok(self.database_params().map(|x| x.database_cache_size()).unwrap_or_default())
}

/// Get the database transaction storage scheme.
fn database_transaction_storage(&self) -> Result<TransactionStorageMode> {
Ok(self
.database_params()
.map(|x| x.transaction_storage())
.unwrap_or(TransactionStorageMode::BlockBody))
}

/// Get the database backend variant.
///
/// By default this is retrieved from `DatabaseParams` if it is available. Otherwise its `None`.
Expand Down Expand Up @@ -519,7 +511,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
state_cache_child_ratio: self.state_cache_child_ratio()?,
state_pruning: self.state_pruning(unsafe_pruning, &role)?,
keep_blocks: self.keep_blocks()?,
transaction_storage: self.database_transaction_storage()?,
wasm_method: self.wasm_method()?,
wasm_runtime_overrides: self.wasm_runtime_overrides(),
execution_strategies: self.execution_strategies(is_dev, is_validator)?,
Expand Down
19 changes: 0 additions & 19 deletions client/cli/src/params/database_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

use crate::arg_enums::Database;
use clap::Args;
use sc_service::TransactionStorageMode;

/// Parameters for block import.
#[derive(Debug, Clone, Args)]
Expand All @@ -36,15 +35,6 @@ pub struct DatabaseParams {
/// Limit the memory the database cache can use.
#[clap(long = "db-cache", value_name = "MiB")]
pub database_cache_size: Option<usize>,

/// Enable storage chain mode
///
/// This changes the storage format for blocks bodies.
/// If this is enabled, each transaction is stored separately in the
/// transaction database column and is only referenced by hash
/// in the block body column.
#[clap(long)]
pub storage_chain: bool,
}

impl DatabaseParams {
Expand All @@ -57,13 +47,4 @@ impl DatabaseParams {
pub fn database_cache_size(&self) -> Option<usize> {
self.database_cache_size
}

/// Transaction storage scheme.
pub fn transaction_storage(&self) -> TransactionStorageMode {
if self.storage_chain {
TransactionStorageMode::StorageChain
} else {
TransactionStorageMode::BlockBody
}
}
}
2 changes: 1 addition & 1 deletion client/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sc-state-db = { version = "0.10.0-dev", path = "../state-db" }
sp-trie = { version = "4.0.0", path = "../../primitives/trie" }
sp-blockchain = { version = "4.0.0-dev", path = "../../primitives/blockchain" }
sp-database = { version = "4.0.0-dev", path = "../../primitives/database" }
parity-db = { version = "0.3.5", optional = true }
parity-db = { version = "0.3.6", optional = true }

[dev-dependencies]
sp-tracing = { version = "4.0.0", path = "../../primitives/tracing" }
Expand Down
Loading