-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix rpc error when encoding default is legacy #1046
Conversation
The rpc code was assuming that a default object header will be in flatbuffers format, but at SPI we have changed it to default to legacy until we are ready to adopt flatbuffer format files. Changing the default causes rpc related tests to fail. It is possible that rpc does not handle legacy format files without the change. Since rpc now sends the FlatObject data over the wire as raw bytes, but when using legacy format the header will be set to legacy, the receiving end tries to respect the header and decode the raw bytes as if they are in legacy format, as would be proper behavior when reading a legacy file from disk. But when decoding an rpc message, the payload is _always_ in flatbuffers format. A new constructor was added that disregards the header's claimed format and always treats the payload as flatbuffers encoded. This also means that the server will write an object with a legacy header out to disk in legacy format. Is this the desired behavior? Should `graph::Object::new_with_default_header` be changed to stop assuming what a "default" header is and hard code itself to use the new encoding? It is unclear if the requirements of this method are to produce a header set the new encoding, or to really just respect whatever the default in the code is set to. Signed-off-by: J Robert Ray <jrray@imageworks.com>
For example, the test
It's easy to see the size is wrong, and the digest is wrong too.
|
crates/spfs/src/graph/object.rs
Outdated
/// In memory, objects always use the latest flatbuffer | ||
/// format. The given bytes may be discarded or reconstructed | ||
/// if a conversion is necessary, but the header is preserved | ||
/// in order to ensure that the object does not change it's |
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 order to ensure that the object does not change it's | |
/// in order to ensure that the object does not change its |
From the meeting today:
|
@jrray can we get this merged in? I'd like to get it worked in downstream as it might help resolve an issue that we're seeing now and then |
Signed-off-by: J Robert Ray <jrray@jrray.org>
@rydrman merged. CI failed for a spurious error, but it had passed previously and all that changed was some text in a comment. |
The rpc code was assuming that a default object header will be in flatbuffers format, but at SPI we have changed it to default to legacy until we are ready to adopt flatbuffer format files. Changing the default causes rpc related tests to fail.
It is possible that rpc does not handle legacy format files without the change.
Since rpc now sends the FlatObject data over the wire as raw bytes, but when using legacy format the header will be set to legacy, the receiving end tries to respect the header and decode the raw bytes as if they are in legacy format, as would be proper behavior when reading a legacy file from disk. But when decoding an rpc message, the payload is always in flatbuffers format.
A new constructor was added that disregards the header's claimed format and always treats the payload as flatbuffers encoded. This also means that the server will write an object with a legacy header out to disk in legacy format. Is this the desired behavior?
Should
graph::Object::new_with_default_header
be changed to stop assuming what a "default" header is and hard code itself to use the new encoding? It is unclear if the requirements of this method are to produce a header set the new encoding, or to really just respect whatever the default in the code is set to.