Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use regions_dataset path for apply_smf #1000

Merged
merged 2 commits into from
Oct 13, 2023
Merged
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
30 changes: 14 additions & 16 deletions agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ enum Args {
},
}

#[derive(Debug)]
pub struct ZFSDataset {
dataset: String,
}
Expand Down Expand Up @@ -1527,6 +1528,16 @@ fn worker(
downstairs_prefix: String,
snapshot_prefix: String,
) {
let regions_dataset_path = match regions_dataset.path() {
Ok(regions_dataset_path) => regions_dataset_path,
Err(e) => {
panic!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this will panic right at the start if the specific regions dataset path does not
exist before we even begin then, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right

"Cannot get regions_dataset_path for {:?}: {}",
regions_dataset, e,
);
}
};

loop {
/*
* This loop fires whenever there's work to do. This work may be:
Expand Down Expand Up @@ -1638,7 +1649,7 @@ fn worker(
let result = apply_smf(
&log,
&df,
dataset_path,
regions_dataset_path.clone(),
&downstairs_prefix,
&snapshot_prefix,
);
Expand All @@ -1651,24 +1662,11 @@ fn worker(
}

State::Tombstoned => 'tombstoned: {
let dataset_path = match regions_dataset.path() {
Ok(dataset_path) => dataset_path,
Err(e) => {
error!(
log,
"Cannot get path on tombstoned dataset {}: {}",
&r.id.0,
e,
);
df.fail(&r.id);
break 'tombstoned;
}
};
info!(log, "applying SMF actions before removal...");
let result = apply_smf(
&log,
&df,
dataset_path,
regions_dataset_path.clone(),
&downstairs_prefix,
&snapshot_prefix,
);
Expand Down Expand Up @@ -1741,7 +1739,7 @@ fn worker(
let result = apply_smf(
&log,
&df,
regions_dataset.path().unwrap(),
regions_dataset_path.clone(),
&downstairs_prefix,
&snapshot_prefix,
);
Expand Down
Loading