Skip to content
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

[v22.3.x] Schema Registry: GET /schemas/ids/<id> should return references #11241

Merged
merged 6 commits into from
Jun 7, 2023

Conversation

BenPope
Copy link
Member

@BenPope BenPope commented Jun 6, 2023

Backport of PR #11216
Fixes #11238,

This will make the next refactor slightly easier.

Signed-off-by: Ben Pope <ben@redpanda.com>
(cherry picked from commit f917875)
This will make the next refactor slightly easier to comprehend.

Signed-off-by: Ben Pope <ben@redpanda.com>
(cherry picked from commit 4972bcc)
Signed-off-by: Ben Pope <ben@redpanda.com>
(cherry picked from commit 5d5072b)
This should be a pure refactoring.

The store has two mappings:
1) `schema_map`: Schema ID to Schema (sharded across cores)
2) `subject_map`: Subject-Versions to Schema ID

Each of these mappings are then split across shards, coordinated
by sharded_store.

Prior to this change, references were attached to the Subject-Versions.

This is an incorrect modelling; Schema should own the references
to other schema. This commit does that refactoring by moving references
from `typed_schema` to `typed_schema_definition`.

There are a couple of things that are not straightforward:
1) `ValidSchema` (`protobuf_schema_definition`, `avro_schema_definition`)
   are the respective library instantiations of the representation,
   and are unable to reproduce their references to form a
   `canonical_schema_definition`, so references are stored inside the
   wrappers.
2) `referenced_by` and `is_reference` now require two phases to
   obtain the references, due to the sharded and diconnected nature of
   the two mappings (schema, and subject-versions).
   a) Obtain a list of schema ids that reference the subject-version
   b) Filter that list by subject-versions that are not soft-deleted

Signed-off-by: Ben Pope <ben@redpanda.com>
(cherry picked from commit 2fc2dfe)

Conflicts:
protobuf.cc due to 7f815f8
sharded_store.cc due to 7f815f8
store.h due to a376f21
post_subject_versions.cc due to 7f815f8
compatibility_protobuf.h due to 5a76733
Signed-off-by: Ben Pope <ben@redpanda.com>
(cherry picked from commit c13d874)
`GET /schemas/ids/<id>` now returns its references.

Fixes redpanda-data#11194

Signed-off-by: Ben Pope <ben@redpanda.com>
(cherry picked from commit 9298788)
@BenPope BenPope added area/schema-registry Schema Registry service within Redpanda kind/backport PRs targeting a stable branch labels Jun 6, 2023
@BenPope BenPope added this to the v22.3.22 milestone Jun 6, 2023
@BenPope BenPope requested a review from dotnwat June 6, 2023 19:13
@BenPope BenPope self-assigned this Jun 6, 2023
@BenPope
Copy link
Member Author

BenPope commented Jun 7, 2023

Copy link
Contributor

@michael-redpanda michael-redpanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked the 5 files that had conflicts, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/redpanda area/schema-registry Schema Registry service within Redpanda kind/backport PRs targeting a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants