No snapshotting by default (#11814)
This commit is contained in:
parent
61e56aba41
commit
b54ddd027d
@ -102,8 +102,8 @@ const MAX_SNAPSHOT_SUBPARTS: usize = 256;
|
|||||||
/// Configuration for the Snapshot service
|
/// Configuration for the Snapshot service
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct SnapshotConfiguration {
|
pub struct SnapshotConfiguration {
|
||||||
/// If `true`, no periodic snapshots will be created
|
/// Enable creation of periodic snapshots
|
||||||
pub no_periodic: bool,
|
pub enable: bool,
|
||||||
/// Number of threads for creating snapshots
|
/// Number of threads for creating snapshots
|
||||||
pub processing_threads: usize,
|
pub processing_threads: usize,
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ pub struct SnapshotConfiguration {
|
|||||||
impl Default for SnapshotConfiguration {
|
impl Default for SnapshotConfiguration {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
SnapshotConfiguration {
|
SnapshotConfiguration {
|
||||||
no_periodic: false,
|
enable: false,
|
||||||
processing_threads: ::std::cmp::max(1, num_cpus::get_physical() / 2),
|
processing_threads: ::std::cmp::max(1, num_cpus::get_physical() / 2),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,9 +795,9 @@ usage! {
|
|||||||
"Skip block seal check.",
|
"Skip block seal check.",
|
||||||
|
|
||||||
["Snapshot Options"]
|
["Snapshot Options"]
|
||||||
FLAG flag_no_periodic_snapshot: (bool) = false, or |c: &Config| c.snapshots.as_ref()?.disable_periodic.clone(),
|
FLAG flag_enable_snapshotting: (bool) = false, or |c: &Config| c.snapshots.as_ref()?.enable.clone(),
|
||||||
"--no-periodic-snapshot",
|
"--enable-snapshotting",
|
||||||
"Disable automated snapshots which usually occur once every 5000 blocks.",
|
"Enable automated snapshots which usually occur once every 5000 blocks.",
|
||||||
|
|
||||||
ARG arg_snapshot_threads: (Option<usize>) = None, or |c: &Config| c.snapshots.as_ref()?.processing_threads,
|
ARG arg_snapshot_threads: (Option<usize>) = None, or |c: &Config| c.snapshots.as_ref()?.processing_threads,
|
||||||
"--snapshot-threads=[NUM]",
|
"--snapshot-threads=[NUM]",
|
||||||
@ -1012,7 +1012,7 @@ struct Footprint {
|
|||||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
struct Snapshots {
|
struct Snapshots {
|
||||||
disable_periodic: Option<bool>,
|
enable: Option<bool>,
|
||||||
processing_threads: Option<usize>,
|
processing_threads: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1419,7 +1419,7 @@ mod tests {
|
|||||||
// -- Snapshot Optons
|
// -- Snapshot Optons
|
||||||
arg_export_state_at: "latest".into(),
|
arg_export_state_at: "latest".into(),
|
||||||
arg_snapshot_at: "latest".into(),
|
arg_snapshot_at: "latest".into(),
|
||||||
flag_no_periodic_snapshot: false,
|
flag_enable_snapshotting: false,
|
||||||
arg_snapshot_threads: None,
|
arg_snapshot_threads: None,
|
||||||
|
|
||||||
// -- Internal Options
|
// -- Internal Options
|
||||||
@ -1609,7 +1609,7 @@ mod tests {
|
|||||||
num_verifiers: None,
|
num_verifiers: None,
|
||||||
}),
|
}),
|
||||||
snapshots: Some(Snapshots {
|
snapshots: Some(Snapshots {
|
||||||
disable_periodic: Some(true),
|
enable: Some(false),
|
||||||
processing_threads: None,
|
processing_threads: None,
|
||||||
}),
|
}),
|
||||||
misc: Some(Misc {
|
misc: Some(Misc {
|
||||||
|
@ -118,7 +118,7 @@ scale_verifiers = true
|
|||||||
num_verifiers = 6
|
num_verifiers = 6
|
||||||
|
|
||||||
[snapshots]
|
[snapshots]
|
||||||
disable_periodic = false
|
enable = false
|
||||||
|
|
||||||
[misc]
|
[misc]
|
||||||
logging = "own_tx=trace"
|
logging = "own_tx=trace"
|
||||||
|
@ -65,7 +65,7 @@ fat_db = "off"
|
|||||||
scale_verifiers = false
|
scale_verifiers = false
|
||||||
|
|
||||||
[snapshots]
|
[snapshots]
|
||||||
disable_periodic = true
|
enable = false
|
||||||
|
|
||||||
[misc]
|
[misc]
|
||||||
logging = "own_tx=trace"
|
logging = "own_tx=trace"
|
||||||
|
@ -967,7 +967,7 @@ impl Configuration {
|
|||||||
|
|
||||||
fn snapshot_config(&self) -> Result<SnapshotConfiguration, String> {
|
fn snapshot_config(&self) -> Result<SnapshotConfiguration, String> {
|
||||||
let conf = SnapshotConfiguration {
|
let conf = SnapshotConfiguration {
|
||||||
no_periodic: self.args.flag_no_periodic_snapshot,
|
enable: self.args.flag_enable_snapshotting,
|
||||||
processing_threads: match self.args.arg_snapshot_threads {
|
processing_threads: match self.args.arg_snapshot_threads {
|
||||||
Some(threads) if threads > 0 => threads,
|
Some(threads) if threads > 0 => threads,
|
||||||
_ => ::std::cmp::max(1, num_cpus::get_physical() / 2),
|
_ => ::std::cmp::max(1, num_cpus::get_physical() / 2),
|
||||||
|
@ -556,9 +556,9 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
|||||||
});
|
});
|
||||||
|
|
||||||
// the watcher must be kept alive.
|
// the watcher must be kept alive.
|
||||||
let watcher = match cmd.snapshot_conf.no_periodic {
|
let watcher = match cmd.snapshot_conf.enable {
|
||||||
true => None,
|
false => None,
|
||||||
false => {
|
true => {
|
||||||
let sync = sync_provider.clone();
|
let sync = sync_provider.clone();
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
let watcher = Arc::new(snapshot::Watcher::new(
|
let watcher = Arc::new(snapshot::Watcher::new(
|
||||||
|
Loading…
Reference in New Issue
Block a user