-
Notifications
You must be signed in to change notification settings - Fork 589
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
CORE-6860 Schema Registry: add detailed verbose compatibility checks #22958
Conversation
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.
looks good. As noted, wrt avro aliases ahead of upstream support: I think we should err on the side of permissiveness, but I don't feel very strongly about it.
src/v/pandaproxy/schema_registry/test/compatibility_protobuf.cc
Outdated
Show resolved
Hide resolved
54e856f
to
9cab4da
Compare
Force-push: minor cleanup after code review |
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/53437#01917eae-8e31-40a0-a7d7-e9c52dc6ba80 |
new failures in https://buildkite.com/redpanda/redpanda/builds/53437#01917eae-8e35-4702-8ad0-06f37c1427a4:
new failures in https://buildkite.com/redpanda/redpanda/builds/53645#0191963a-9a6a-49ee-a8fd-012d2f6efd59:
|
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.
Looks great. Just a few minor things.
In general I find it easier to review code when it has tests, and tests when it has code, so I'd reorder and squash some commits.
Also, verbose out should be in the response of POST /subjects/<subject>/versions
, which is roughly along the lines of:
index b882f9e003..01c79f85c9 100644
--- a/src/v/pandaproxy/schema_registry/sharded_store.cc
+++ b/src/v/pandaproxy/schema_registry/sharded_store.cc
@@ -201,14 +201,15 @@ sharded_store::get_schema_version(subject_schema schema) {
// Check compatibility of the schema
if (!v_id.has_value() && !versions.empty()) {
auto compat = co_await is_compatible(
- versions.back().version, schema.schema.share());
- if (!compat) {
+ versions.back().version, schema.schema.share(), verbose::yes);
+ if (!compat.is_compat) {
throw exception(
error_code::schema_incompatible,
fmt::format(
"Schema being registered is incompatible with an earlier "
- "schema for subject \"{}\"",
- sub));
+ "schema for subject \"{}\", details: {}",
+ sub,
+ compat.messages));
}
}
co_return has_schema_result{s_id, v_id};
But the messages are rendered inside of "{}" instead of "[]"
compat_result.emplace<proto_incompatibility>( | ||
p / w->name(), proto_incompatibility::Type::message_removed); | ||
} else { | ||
compat_result.merge(check_compatible(r, w, p / w->name())); |
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.
nit: Missing test
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.
Good spot! reader->FindNestedTypeByName
above actually takes a relative name and not a fully qualified name
9cab4da
to
d9d29bb
Compare
Common test code for working with detailed compatibility info about protobuf and avro schemas.
When an incompatible schema is posted, include the verbose compatibility messages in the error message. This helps users understand the reason for the incompatibility and it matches the reference implementation. Includes a minor fix to the way the compatibility level message is formatted.
d9d29bb
to
cda768b
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.
latest round lgtm
BOOST_REQUIRE_MESSAGE( | ||
errs == expected, | ||
fmt::format("{} != {}", format_set(errs), format_set(expected))); | ||
} |
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.
nice!
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.
LGTM
/backport v24.2.x |
/backport v24.1.x |
/backport v23.3.x |
Failed to create a backport PR to v24.2.x branch. I tried:
|
Failed to create a backport PR to v23.3.x branch. I tried:
|
Failed to create a backport PR to v24.1.x branch. I tried:
|
This implements detailed compatibility checks for protobuf and avro in schema registry. This enabled the schema registry and rpk to surface more specific information about the cause of the incompatibility between a new schema and the existing schemas by pointing the user to the exact incompatibility. This PR aims only to change the error reporting behaviour of the check compatibility endpoint when the
?verbose=true
parameter is explicitly specified and does not change the rules of what schema pairs are (in)compatible.This PR was cherry-picked and then adapted from @oleiman's earlier PR #18332.
Fixes https://redpandadata.atlassian.net/browse/CORE-6860
Backports Required
Release Notes
Improvements
Bug Fixes