sled-agent cleanup: replace DiskManagementError::Other with specific variants (PR 2/2) - #10898
Conversation
| // might be retryable? in many of these cases we'd need more | ||
| // information from the inner error than they expose, so we'll | ||
| // err on the side of retrying |
There was a problem hiding this comment.
This is a behavior change, but I think is more correct? I'm not sure. Could change this branch to false if it seems fishy, which would match the behavior on main.
There was a problem hiding this comment.
I like this better. I had to remind myself how this all works. I agree this seems "more correct".
There was a problem hiding this comment.
I suppose we could also change this to return, like
enum Retryable {
Yes,
No,
IfYoureLucky,
}| "Failed to access keys necessary to unlock storage. \ | ||
| This error may be transient." | ||
| )] | ||
| KeyManager(String), |
There was a problem hiding this comment.
Is this now absorbed by other errors?
There was a problem hiding this comment.
Nevermind. I see it was only returned from the one place you changed to the broader AdoptDisk error. Looks good.
| // might be retryable? in many of these cases we'd need more | ||
| // information from the inner error than they expose, so we'll | ||
| // err on the side of retrying |
There was a problem hiding this comment.
I like this better. I had to remind myself how this all works. I agree this seems "more correct".
| // The errors below are all from `illumos-utils`, and already include | ||
| // context like the name of the dataset on which we're operating. | ||
| #[error(transparent)] | ||
| ListDatasets(#[from] ListDatasetsError), | ||
|
|
||
| #[error(transparent)] | ||
| EnsureDataset(#[from] EnsureDatasetError), | ||
|
|
||
| #[error(transparent)] | ||
| DestroyDataset(#[from] DestroyDatasetError), | ||
|
|
||
| #[error(transparent)] | ||
| SetValues(#[from] SetValueError), |
There was a problem hiding this comment.
this is all like, 1000x nicer. you love to see it!
sunshowers
left a comment
There was a problem hiding this comment.
I think overall I'd prefer this commit (which is mostly great) to not change any behaviors.
| | Self::DestroyDataset(DestroyDatasetError { | ||
| name: _, | ||
| err: DestroyDatasetErrorVariant::NotFound, | ||
| }) => false, |
There was a problem hiding this comment.
apologies for the dumb question here but what is retryable supposed to mean in this context, and what concrete behaviors does a retryable determination of true or false result in? I think there are two separate things being mixed here: a retry won't change the outcome, and this is a terminal failure. Those two things often coincide, but are different in the case of an idempotent operation where a retry won't change the outcome, but also it is actually a success.
In particular, it looks like DestroyDatasetErrorVariant::NotFound is produced by Zfs::destroy_dataset. An attempt to destroy a dataset that isn't present seems like a pretty archetypal idempotent operation.
There was a problem hiding this comment.
oh god. staring at this code again, I guess the old code marked this false as well. this makes me uncomfortable but I guess isn't really a behavior change ¯\_(ツ)_/¯
| Self::AdoptDisk { .. } | ||
| | Self::ListDatasets(_) | ||
| | Self::EnsureDataset(_) | ||
| | Self::DestroyDataset(DestroyDatasetError { | ||
| name: _, | ||
| err: DestroyDatasetErrorVariant::Other(_), | ||
| }) | ||
| | Self::SetValues(_) => true, |
There was a problem hiding this comment.
the catch-all variants make me a little uncomfortable -- can we add is_retryable or some equivalent to all the wrapped errors so the determination is more local?
No description provided.