Skip to content

Commit

Permalink
Merge pull request #2634 from subspace/fix-sector-scrub
Browse files Browse the repository at this point in the history
Fix sector scrub
  • Loading branch information
nazar-pc authored Mar 22, 2024
2 parents 3ea1f8b + 07b6028 commit 63f476a
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 114 deletions.
1 change: 1 addition & 0 deletions crates/subspace-farmer-components/src/plotting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ where
// * sector contents map
// * record chunks as s-buckets
// * record metadata
// * checksum
{
let (sector_contents_map_region, remaining_bytes) =
sector_output.split_at_mut(SectorContentsMap::encoded_size(pieces_in_sector));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::PathBuf;
use subspace_farmer::single_disk_farm::SingleDiskFarm;
use tracing::{error, info, info_span};

pub(crate) fn scrub(disk_farms: &[PathBuf], disable_farm_locking: bool) {
pub(crate) fn scrub(disk_farms: &[PathBuf], disable_farm_locking: bool, dry_run: bool) {
disk_farms
.into_par_iter()
.enumerate()
Expand All @@ -15,7 +15,7 @@ pub(crate) fn scrub(disk_farms: &[PathBuf], disable_farm_locking: bool) {
"Start scrubbing farm"
);

match SingleDiskFarm::scrub(directory, disable_farm_locking) {
match SingleDiskFarm::scrub(directory, disable_farm_locking, dry_run) {
Ok(()) => {
info!(
path = %directory.display(),
Expand Down
6 changes: 5 additions & 1 deletion crates/subspace-farmer/src/bin/subspace-farmer/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ enum Command {
/// Disable farm locking, for example if file system doesn't support it
#[arg(long)]
disable_farm_locking: bool,
/// Check for errors, but do not attempt to correct them
#[arg(long)]
dry_run: bool,
},
/// Wipes the farm
Wipe {
Expand Down Expand Up @@ -101,11 +104,12 @@ async fn main() -> anyhow::Result<()> {
Command::Scrub {
disk_farms,
disable_farm_locking,
dry_run,
} => {
if disk_farms.is_empty() {
info!("No farm was specified, so there is nothing to do");
} else {
commands::scrub(&disk_farms, disable_farm_locking);
commands::scrub(&disk_farms, disable_farm_locking, dry_run);
}
}
Command::Wipe { disk_farms } => {
Expand Down
Loading

0 comments on commit 63f476a

Please sign in to comment.