db: remove wal disabling / fast-and-loose option. (#8963)

* parity: highlight --fast-and-loose is not recommended.

* parity: remove fast-and-loose option, ref #1765

* db: remove db wal from options, it's always enabled

* db: remove wal from rocksdb helpers

* cli: fix wallet import test

* ethcore: fix client config tests

* parity: proper deprecated handling for fast-and-loose

* ethcore-client: fix config

* parity: mark fast-and-loose removed

* parity: fix test_find_deprecated

* parity: fix type for fast-and-loose flag

* lock file
This commit is contained in:
Afri Schoedon 2018-07-10 17:33:25 +02:00 committed by David
parent 526c61e2c0
commit da5de4a6ff
16 changed files with 32 additions and 62 deletions

28
Cargo.lock generated
View File

@ -1223,7 +1223,7 @@ dependencies = [
[[package]]
name = "hashdb"
version = "0.2.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1487,7 +1487,7 @@ dependencies = [
[[package]]
name = "keccak-hash"
version = "0.1.2"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1515,7 +1515,7 @@ dependencies = [
[[package]]
name = "kvdb"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common)",
@ -1524,7 +1524,7 @@ dependencies = [
[[package]]
name = "kvdb-memorydb"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"kvdb 0.1.0 (git+https://github.com/paritytech/parity-common)",
"parking_lot 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1533,7 +1533,7 @@ dependencies = [
[[package]]
name = "kvdb-rocksdb"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1704,7 +1704,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memorydb"
version = "0.2.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hashdb 0.2.0 (git+https://github.com/paritytech/parity-common)",
@ -2106,7 +2106,7 @@ dependencies = [
[[package]]
name = "parity-bytes"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
[[package]]
name = "parity-clib"
@ -2118,7 +2118,7 @@ dependencies = [
[[package]]
name = "parity-crypto"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2457,7 +2457,7 @@ dependencies = [
[[package]]
name = "path"
version = "0.1.1"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2465,7 +2465,7 @@ dependencies = [
[[package]]
name = "patricia-trie"
version = "0.2.1"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hashdb 0.2.0 (git+https://github.com/paritytech/parity-common)",
@ -2540,7 +2540,7 @@ dependencies = [
[[package]]
name = "plain_hasher"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2809,7 +2809,7 @@ dependencies = [
[[package]]
name = "rlp"
version = "0.2.1"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3537,7 +3537,7 @@ dependencies = [
[[package]]
name = "trie-standardmap"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.1.2 (git+https://github.com/paritytech/parity-common)",
@ -3548,7 +3548,7 @@ dependencies = [
[[package]]
name = "triehash"
version = "0.2.0"
source = "git+https://github.com/paritytech/parity-common#d322bcebd2303306a8f259ea38026598a5b439c0"
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
dependencies = [
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -276,7 +276,6 @@ mod tests {
client_db_config.memory_budget = client_config.db_cache_size;
client_db_config.compaction = CompactionProfile::auto(&client_path);
client_db_config.wal = client_config.db_wal;
let client_db_handler = test_helpers::restoration_db_handler(client_db_config.clone());
let client_db = client_db_handler.open(&client_path).unwrap();

View File

@ -102,8 +102,6 @@ pub struct ClientConfig {
pub db_cache_size: Option<usize>,
/// State db compaction profile
pub db_compaction: DatabaseCompactionProfile,
/// Should db have WAL enabled?
pub db_wal: bool,
/// Operating mode
pub mode: Mode,
/// The chain spec name
@ -137,7 +135,6 @@ impl Default for ClientConfig {
name: "default".into(),
db_cache_size: None,
db_compaction: Default::default(),
db_wal: true,
mode: Mode::Active,
spec_name: "".into(),
verifier_type: VerifierType::Canon,

View File

@ -90,7 +90,6 @@ pub struct ImportBlockchain {
pub pruning_history: u64,
pub pruning_memory: usize,
pub compaction: DatabaseCompactionProfile,
pub wal: bool,
pub tracing: Switch,
pub fat_db: Switch,
pub vm_type: VMType,
@ -111,7 +110,6 @@ pub struct ExportBlockchain {
pub pruning_history: u64,
pub pruning_memory: usize,
pub compaction: DatabaseCompactionProfile,
pub wal: bool,
pub fat_db: Switch,
pub tracing: Switch,
pub from_block: BlockId,
@ -130,7 +128,6 @@ pub struct ExportState {
pub pruning_history: u64,
pub pruning_memory: usize,
pub compaction: DatabaseCompactionProfile,
pub wal: bool,
pub fat_db: Switch,
pub tracing: Switch,
pub at: BlockId,
@ -207,8 +204,7 @@ fn execute_import_light(cmd: ImportBlockchain) -> Result<(), String> {
// initialize database.
let db = db::open_db(&client_path.to_str().expect("DB path could not be converted to string."),
&cmd.cache_config,
&cmd.compaction,
cmd.wal).map_err(|e| format!("Failed to open database: {:?}", e))?;
&cmd.compaction).map_err(|e| format!("Failed to open database: {:?}", e))?;
// TODO: could epoch signals be avilable at the end of the file?
let fetch = ::light::client::fetch::unavailable();
@ -351,7 +347,6 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
tracing,
fat_db,
cmd.compaction,
cmd.wal,
cmd.vm_type,
"".into(),
algorithm,
@ -494,7 +489,6 @@ fn start_client(
tracing: Switch,
fat_db: Switch,
compaction: DatabaseCompactionProfile,
wal: bool,
cache_config: CacheConfig,
require_fat_db: bool,
) -> Result<ClientService, String> {
@ -544,7 +538,6 @@ fn start_client(
tracing,
fat_db,
compaction,
wal,
VMType::default(),
"".into(),
algorithm,
@ -586,7 +579,6 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
cmd.tracing,
cmd.fat_db,
cmd.compaction,
cmd.wal,
cmd.cache_config,
false,
)?;
@ -631,7 +623,6 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> {
cmd.tracing,
cmd.fat_db,
cmd.compaction,
cmd.wal,
cmd.cache_config,
true
)?;

View File

@ -814,10 +814,6 @@ usage! {
"Specify a filename into which logging should be appended.",
["Footprint Options"]
FLAG flag_fast_and_loose: (bool) = false, or |c: &Config| c.footprint.as_ref()?.fast_and_loose.clone(),
"--fast-and-loose",
"Disables DB WAL, which gives a significant speed up but means an unclean exit is unrecoverable.",
FLAG flag_scale_verifiers: (bool) = false, or |c: &Config| c.footprint.as_ref()?.scale_verifiers.clone(),
"--scale-verifiers",
"Automatically scale amount of verifier threads based on workload. Not guaranteed to be faster.",
@ -967,6 +963,12 @@ usage! {
"--ui-no-validation",
"Does nothing; UI is now a separate project.",
// FLAG Removed in 2.0.
FLAG flag_fast_and_loose: (bool) = false, or |_| None,
"--fast-and-loose",
"Does nothing; DB WAL is always activated.",
// ARG Removed in 1.6 or before.
ARG arg_etherbase: (Option<String>) = None, or |_| None,

View File

@ -150,7 +150,6 @@ cache_size_blocks = 8
cache_size_queue = 50
cache_size_state = 25
cache_size = 128 # Overrides above caches with total size
fast_and_loose = false
db_compaction = "ssd"
fat_db = "auto"
scale_verifiers = true

View File

@ -134,7 +134,6 @@ impl Configuration {
let tracing = self.args.arg_tracing.parse()?;
let fat_db = self.args.arg_fat_db.parse()?;
let compaction = self.args.arg_db_compaction.parse()?;
let wal = !self.args.flag_fast_and_loose;
let warp_sync = !self.args.flag_no_warp;
let geth_compatibility = self.args.flag_geth;
let dapps_conf = self.dapps_config();
@ -236,7 +235,6 @@ impl Configuration {
pruning_history: pruning_history,
pruning_memory: self.args.arg_pruning_memory,
compaction: compaction,
wal: wal,
tracing: tracing,
fat_db: fat_db,
vm_type: vm_type,
@ -258,7 +256,6 @@ impl Configuration {
pruning_history: pruning_history,
pruning_memory: self.args.arg_pruning_memory,
compaction: compaction,
wal: wal,
tracing: tracing,
fat_db: fat_db,
from_block: to_block_id(&self.args.arg_export_blocks_from)?,
@ -277,7 +274,6 @@ impl Configuration {
pruning_history: pruning_history,
pruning_memory: self.args.arg_pruning_memory,
compaction: compaction,
wal: wal,
tracing: tracing,
fat_db: fat_db,
at: to_block_id(&self.args.arg_export_state_at)?,
@ -302,7 +298,6 @@ impl Configuration {
fat_db: fat_db,
compaction: compaction,
file_path: self.args.arg_snapshot_file.clone(),
wal: wal,
kind: snapshot::Kind::Take,
block_at: to_block_id(&self.args.arg_snapshot_at)?,
};
@ -319,7 +314,6 @@ impl Configuration {
fat_db: fat_db,
compaction: compaction,
file_path: self.args.arg_restore_file.clone(),
wal: wal,
kind: snapshot::Kind::Restore,
block_at: to_block_id("latest")?, // unimportant.
};
@ -331,7 +325,6 @@ impl Configuration {
spec: spec,
pruning: pruning,
compaction: compaction,
wal: wal,
};
Cmd::ExportHardcodedSync(export_hs_cmd)
} else {
@ -372,7 +365,6 @@ impl Configuration {
tracing: tracing,
fat_db: fat_db,
compaction: compaction,
wal: wal,
vm_type: vm_type,
warp_sync: warp_sync,
warp_barrier: self.args.arg_warp_barrier,
@ -1281,7 +1273,6 @@ mod tests {
pruning_history: 64,
pruning_memory: 32,
compaction: Default::default(),
wal: true,
tracing: Default::default(),
fat_db: Default::default(),
vm_type: VMType::Interpreter,
@ -1306,7 +1297,6 @@ mod tests {
pruning_memory: 32,
format: Default::default(),
compaction: Default::default(),
wal: true,
tracing: Default::default(),
fat_db: Default::default(),
from_block: BlockId::Number(1),
@ -1329,7 +1319,6 @@ mod tests {
pruning_memory: 32,
format: Default::default(),
compaction: Default::default(),
wal: true,
tracing: Default::default(),
fat_db: Default::default(),
at: BlockId::Latest,
@ -1354,7 +1343,6 @@ mod tests {
pruning_memory: 32,
format: Some(DataFormat::Hex),
compaction: Default::default(),
wal: true,
tracing: Default::default(),
fat_db: Default::default(),
from_block: BlockId::Number(1),
@ -1442,7 +1430,6 @@ mod tests {
mode: Default::default(),
tracing: Default::default(),
compaction: Default::default(),
wal: true,
vm_type: Default::default(),
geth_compatibility: false,
net_settings: Default::default(),

View File

@ -32,7 +32,6 @@ pub fn client_db_config(client_path: &Path, client_config: &ClientConfig) -> Dat
client_db_config.memory_budget = client_config.db_cache_size;
client_db_config.compaction = compaction_profile(&client_config.db_compaction, &client_path);
client_db_config.wal = client_config.db_wal;
client_db_config
}

View File

@ -218,7 +218,6 @@ pub fn migrate(path: &Path, compaction_profile: &DatabaseCompactionProfile) -> R
memory_budget: None,
compaction: compaction_profile,
columns: db::NUM_COLUMNS,
wal: true,
};
migrate_blooms(&db_path, &db_config).map_err(Error::BloomsDB)?;

View File

@ -86,13 +86,12 @@ pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig)
}
/// Open a new main DB.
pub fn open_db(client_path: &str, cache_config: &CacheConfig, compaction: &DatabaseCompactionProfile, wal: bool) -> io::Result<Arc<BlockChainDB>> {
pub fn open_db(client_path: &str, cache_config: &CacheConfig, compaction: &DatabaseCompactionProfile) -> io::Result<Arc<BlockChainDB>> {
let path = Path::new(client_path);
let db_config = DatabaseConfig {
memory_budget: Some(cache_config.blockchain() as usize * 1024 * 1024),
compaction: helpers::compaction_profile(&compaction, path),
wal,
.. DatabaseConfig::with_columns(NUM_COLUMNS)
};

View File

@ -203,6 +203,12 @@ pub fn find_deprecated(args: &Args) -> Vec<Deprecated> {
result.push(Deprecated::Removed("--tx-queue-ban-time"));
}
// Removed in 2.0.
if args.flag_fast_and_loose {
result.push(Deprecated::Removed("--fast-and-loose"));
}
result
}
@ -233,6 +239,7 @@ mod tests {
args.arg_dapps_user = Some(Default::default());
args.arg_dapps_pass = Some(Default::default());
args.flag_dapps_apis_all = true;
args.flag_fast_and_loose = true;
args
}), vec![
Deprecated::DoesNothing("--warp"),
@ -252,6 +259,7 @@ mod tests {
Deprecated::Removed("--dapps-user"),
Deprecated::Removed("--dapps-pass"),
Deprecated::Replaced("--dapps-apis-all", "--jsonrpc-apis"),
Deprecated::Removed("--fast-and-loose"),
]);
}
}

View File

@ -40,7 +40,6 @@ pub struct ExportHsyncCmd {
pub spec: SpecType,
pub pruning: Pruning,
pub compaction: DatabaseCompactionProfile,
pub wal: bool,
}
pub fn execute(cmd: ExportHsyncCmd) -> Result<String, String> {
@ -89,8 +88,7 @@ pub fn execute(cmd: ExportHsyncCmd) -> Result<String, String> {
// initialize database.
let db = db::open_db(&db_dirs.client_path(algorithm).to_str().expect("DB path could not be converted to string."),
&cmd.cache_config,
&cmd.compaction,
cmd.wal).map_err(|e| format!("Failed to open database {:?}", e))?;
&cmd.compaction).map_err(|e| format!("Failed to open database {:?}", e))?;
let service = light_client::Service::start(config, &spec, UnavailableDataFetcher, db, cache)
.map_err(|e| format!("Error starting light client: {}", e))?;

View File

@ -210,7 +210,6 @@ pub fn to_client_config(
tracing: bool,
fat_db: bool,
compaction: DatabaseCompactionProfile,
wal: bool,
vm_type: VMType,
name: String,
pruning: Algorithm,
@ -246,7 +245,6 @@ pub fn to_client_config(
client_config.pruning = pruning;
client_config.history = pruning_history;
client_config.db_compaction = compaction;
client_config.db_wal = wal;
client_config.vm_type = vm_type;
client_config.name = name;
client_config.verifier_type = if check_seal { VerifierType::Canon } else { VerifierType::CanonNoSeal };

View File

@ -109,7 +109,6 @@ pub struct RunCmd {
pub tracing: Switch,
pub fat_db: Switch,
pub compaction: DatabaseCompactionProfile,
pub wal: bool,
pub vm_type: VMType,
pub geth_compatibility: bool,
pub net_settings: NetworkSettings,
@ -221,8 +220,7 @@ fn execute_light_impl(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<Runnin
// initialize database.
let db = db::open_db(&db_dirs.client_path(algorithm).to_str().expect("DB path could not be converted to string."),
&cmd.cache_config,
&cmd.compaction,
cmd.wal).map_err(|e| format!("Failed to open database {:?}", e))?;
&cmd.compaction).map_err(|e| format!("Failed to open database {:?}", e))?;
let service = light_client::Service::start(config, &spec, fetch, db, cache.clone())
.map_err(|e| format!("Error starting light client: {}", e))?;
@ -571,7 +569,6 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq:
tracing,
fat_db,
cmd.compaction,
cmd.wal,
cmd.vm_type,
cmd.name,
algorithm,

View File

@ -60,7 +60,6 @@ pub struct SnapshotCommand {
pub fat_db: Switch,
pub compaction: DatabaseCompactionProfile,
pub file_path: Option<String>,
pub wal: bool,
pub kind: Kind,
pub block_at: BlockId,
}
@ -173,7 +172,6 @@ impl SnapshotCommand {
tracing,
fat_db,
self.compaction,
self.wal,
VMType::default(),
"".into(),
algorithm,

View File

@ -252,7 +252,6 @@ impl Manager {
memory_budget: None,
compaction: config.compaction_profile,
columns: columns,
wal: true,
};
let db_root = database_path(old_path);