-
Notifications
You must be signed in to change notification settings - Fork 49
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
Schema registry design proposal #511
Conversation
1ebf613
to
91b7d27
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.
The idea of the schema
package make sense to me. Having a single source Schemas
which contains the schema information and then exposes the different views to it via traits sounds like a good idea to me. This will hopefully help us keeping schema information consistent.
Once we go distributed then there will probably be a small difference between the schema registry running on the meta and the ones being local to the worker which is that the latter might want to ask the former for an update if a resolution operation failed because some information was missing.
91b7d27
to
bbd8b36
Compare
@tillrohrmann this PR is ready to be reviewed again I think. I updated it with the latest changes and rebased on #551. |
a76f259
to
bb3a239
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.
Thanks for creating this PR @slinkydeveloper. The changes make sense to me. I had a few minor comments. +1 for merging this PR once they are resolved and the preceding PR gets merged.
src/schema/src/proto_symbol.rs
Outdated
// We should try to not leak prost_reflect types as they can be problematic to implement | ||
// the consistent schema view in future. |
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.
Can you add an explanation why this is the case?
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 comment doesn't apply with last commits.
// I need to run this twice to make sure I split the file descriptor set between prod and test | ||
prost_build::Config::new() | ||
.file_descriptor_set_path( | ||
PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR environment variable not set")) | ||
.join("file_descriptor_set_test.bin"), | ||
) | ||
.bytes(["."]) | ||
.compile_protos(&["tests/proto/test.proto"], &["tests/proto"])?; |
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 guess this can't be within a if cfg!(test)
or so?
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.
No, build.rs is once per project: rust-lang/cargo#1581 rust-lang/cargo#1430
src/schema_impl/src/proto_symbol.rs
Outdated
@@ -89,7 +89,7 @@ impl ProtoSymbols { | |||
for file in &files { | |||
// We rename files prepending them with the endpoint id | |||
// to avoid collision between file names of unrelated endpoints | |||
// TODO this should probably go in https://github.com/restatedev/restate/issues/43 | |||
// TODO with schema checks in place, should we move this or remove 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.
Remove prepending the endpoint_id
you mean?
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.
yep, changed the comment to specify that.
91d6d96
to
c02b103
Compare
5706bcc
to
50b8f0f
Compare
Designed the various interfaces around schema registry. Define `Schemas`, the schema registry. Port most of the code from `restate_key_extraction`.
Implement the logic to register a endpoint in `register_new_endpoint`. This is copy pasted to meta::Service::reload
…s copy-pasted from restate_service_key_extractor
…e logic to parse InvokeRequest from the ingress.
50b8f0f
to
b42d9cc
Compare
Part of #43.
This PR contains a design proposal for the schema registry. The idea of the next steps is the following:
Schemas
and the interfaces. All the other types should live inrestate_types
, as described in Refactorcommon
#420Schemas
will get an implementation of each of the defined interfaces, all of them sharing the same tree of Endpoint/Service/DescriptorPool metadata under a singleArcSwap
. We can also reason about potential optimizations using thread locals, as described here: Investigate whetherArc<ArcSwap>
for accessing shuffle senders in network is more efficient thanArc<Mutex>
#136 (comment)restate_service_metadata
andrestate_key_extractor
modulesSchemas#register_new_endpoint
. This will contain down the road the logic for:Schemas
object in the distributed mode will be updated by the "node service" somehow, perhaps not throughregister_new_endpoint
but a rather simple method that will apply some "diff" calculated by the meta service. Perhaps moving forwardregister_new_endpoint
will be split between doing checks, calculating the diff and then applying the diff itself.