Skip to content

Commit

Permalink
dont fail at failing
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Hanson committed Oct 13, 2023
1 parent 1a56db9 commit d65da02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
22 changes: 5 additions & 17 deletions agent/src/datafile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ impl DataFile {
* - Already destroyed; no more work to do.
*/
}
State::Requested | State::Created => {
State::Requested | State::Created | State::Failed => {
/*
* Schedule the destruction of this region.
*/
Expand All @@ -697,17 +697,6 @@ impl DataFile {
self.bell.notify_all();
self.store(inner);
}
State::Failed => {
/*
* For now, this terminal state will preserve evidence for
* investigation.
*/
bail!(
"region {} failed to provision and cannot be \
destroyed",
r.id.0
);
}
}

Ok(())
Expand Down Expand Up @@ -773,7 +762,10 @@ impl DataFile {
let region = region.unwrap();

match region.state {
State::Requested | State::Destroyed | State::Tombstoned => {
State::Requested
| State::Destroyed
| State::Tombstoned
| State::Failed => {
// Either the region hasn't been created yet, or it has been
// destroyed or marked to be destroyed (both of which require
// that no snapshots exist). Return an empty list.
Expand All @@ -783,10 +775,6 @@ impl DataFile {
State::Created => {
// proceed to next section
}

State::Failed => {
bail!("region.state is failed!");
}
}

let mut path = self.base_path.to_path_buf();
Expand Down
14 changes: 3 additions & 11 deletions agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl ZFSDataset {

if i == 4 {
bail!(
"zfs list mountpoint failed! out:{} err:{}",
"zfs destroy dataset failed! out:{} err:{}",
out,
err
);
Expand Down Expand Up @@ -1589,15 +1589,7 @@ fn worker(
&r.id.0,
e,
);
if let Err(e) = df.destroyed(&r.id) {
error!(
log,
"Dataset {} destruction failed: {}",
&r.id.0,
e,
);
df.fail(&r.id);
}
df.fail(&r.id);
break 'requested;
}
};
Expand Down Expand Up @@ -1699,7 +1691,7 @@ fn worker(
r.id.0,
e,
);
df.fail(&r.id);
let _ = df.destroyed(&r.id);
break 'tombstoned;
}
};
Expand Down

0 comments on commit d65da02

Please sign in to comment.