-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Get rid of get_blobs_not_found and unify blob errors #2649
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
c5174be
to
b49501f
Compare
linera-execution/src/system.rs
Outdated
#[error("Oracle response mismatch")] | ||
OracleResponseMismatch, | ||
#[error("No recorded response for oracle query")] | ||
MissingOracleResponse, | ||
} | ||
|
||
impl SystemExecutionError { | ||
pub fn get_blobs_not_found(&self) -> Option<Vec<BlobId>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the rest of the code, we try to normalize the errors during conversion instead. In this case, I wonder why we have so many kinds of BlobsNotFound
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(There's also #2628 for this.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree this is not the ideal end solution for this, this is just an intermediate step until we get to #2628
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a TODO(#2628)
to both get_blobs_not_found
functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
78912fd
to
bb341a0
Compare
84566e6
to
ca23cb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. It mainly shows that we have too many error types that are nested in too many ways. But cleaning those up is beyond the scope of this PR, of course.
I'm also a bit concerned about the fact that we now convert BlobsNotFound
to the corresponding variant of the higher-level type implicitly everywhere, using ?
: Should they really be treated all the same? E.g. aren't there cases where a validator should locally expect to have a particular blob—i.e. should respond with something like an "internal error"—that are different from other places where it's correct to respond with a BlobsNotFound
to the client, so they can send them to us?
Anyway, I'm approving this for now because I don't have a simple better idea and I don't think it introduces new problems, but I'd prefer if we could get another opinion on this PR, by a second reviewer.
0e1d67d
to
e9a3222
Compare
Those are good points. I think right now though, AFAIU, the behavior is that we always return the error to the client, and fail on the client if the blob is actually not found. This is a behavior that could be looked into though, if we think it should be done differently 🤔 |
linera-core/src/client/mod.rs
Outdated
error => Self::RemoteNodeError(error), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think this is a conversion we should not make, since we will want to distinguish: If the error is that the remote node doesn't have a blob, we need to send it. If the error is that we don't have a blob, we need to request it or fail. (See #2871.)
linera-core/src/client/mod.rs
Outdated
} else { | ||
Err(LocalNodeError::BlobsNotFound(blob_ids)) => { | ||
let blobs = remote_node.try_download_blobs(blob_ids.as_slice()).await; | ||
if blobs.len() != blob_ids.len() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is weird but changed in the next PR, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @afck had a PR that fixed this behavior, so this is already gone in my local version of this PR. Will update it in a bit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't I already merge that? I think try_download_blobs
returns None
if it couldn't download all requested blobs? So I think you can remove this comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's what I said 😅 already have that done locally, but haven't updated the PR yet
e9a3222
to
b550792
Compare
Motivation
We've had these two different error variants for blobs for a while:
BlobNotFoundOnRead
andBlobsNotFound
. The motivation was to differentiate between errors when doing a storage read, and everything else. In the current state of the code, I don't think this distinction is really giving us much, and it complicates the code more.We also have this
get_blobs_not_found
function that abstracts away the different nested error types.Proposal
Remove
BlobNotFoundOnRead
, and simplify things a bit. Wrote custom/manualFrom
implementations for these different error types, so we can have aBlobsNotFound
error everywhere and can get rid ofget_blobs_not_found
.Fixes #2628
Test Plan
CI
Release Plan