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

CORE-5083 schema_registry: last subject deletes schema #20847

Merged

Conversation

pgellert
Copy link
Contributor

@pgellert pgellert commented Jul 4, 2024

When the last subject version corresponding to a schema is deleted, schema registry should also remove the schema.

On the topic, the schema is already considered deleted when the last subject version is deleted, and compaction takes care of removing it. However, without this change, compaction needs to happen and then a node restart needs to happen before the schema is removed from memory. This is not ideal for use cases where schemas are frequently created and deleted (eg. Serverless), so instead we can remove the schema from memory when its last subject version is deleted.

Fixes https://redpandadata.atlassian.net/browse/CORE-5083

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.1.x
  • v23.3.x
  • v23.2.x

Release Notes

Improvements

  • Schema Registry: remove the schema from memory when the last subject version referencing it is deleted.

@pgellert pgellert requested a review from a team July 4, 2024 16:52
@pgellert pgellert self-assigned this Jul 4, 2024
@pgellert pgellert requested review from aanthony-rp and BenPope and removed request for a team July 4, 2024 16:52
@pgellert pgellert force-pushed the sr/fix-permanent-delete-schema branch from 4711b4c to d6e8d42 Compare July 5, 2024 09:34
@pgellert
Copy link
Contributor Author

pgellert commented Jul 5, 2024

Force-push: code review feedback

@pgellert pgellert requested a review from BenPope July 5, 2024 09:35
BenPope
BenPope previously approved these changes Jul 5, 2024
src/v/pandaproxy/schema_registry/sharded_store.cc Outdated Show resolved Hide resolved
src/v/pandaproxy/schema_registry/sharded_store.cc Outdated Show resolved Hide resolved
@pgellert pgellert force-pushed the sr/fix-permanent-delete-schema branch from d6e8d42 to 367a36e Compare July 5, 2024 12:35
@pgellert
Copy link
Contributor Author

pgellert commented Jul 5, 2024

Force-push: address more code review suggestions

@pgellert pgellert requested a review from BenPope July 5, 2024 12:36
Add support to `store::subject_versions_has_any_of` for including
deleted subject versions.
@pgellert pgellert force-pushed the sr/fix-permanent-delete-schema branch from 367a36e to cd515cc Compare July 5, 2024 12:41
@pgellert
Copy link
Contributor Author

pgellert commented Jul 5, 2024

Force-push: fix linting error

BenPope
BenPope previously approved these changes Jul 5, 2024
andijcr
andijcr previously approved these changes Jul 5, 2024
When the last subject version corresponding to a schema is deleted,
Schema Registry should also remove the schema.

On the topic, the schema is already considered deleted when the last
subject version is deleted, and compaction takes care of removing it.
However, without this change, compaction needs to happen and then a node
restart needs to happen before the schema is removed from memory. This
is not ideal for use cases where schemas are frequently created and
deleted (eg. Serverless), so instead we can remove the schema from
memory when its last subject version is deleted.
@pgellert pgellert dismissed stale reviews from andijcr and BenPope via d85de7b July 5, 2024 15:25
@pgellert pgellert force-pushed the sr/fix-permanent-delete-schema branch from cd515cc to d85de7b Compare July 5, 2024 15:25
@pgellert
Copy link
Contributor Author

pgellert commented Jul 5, 2024

Force-push: fix potential use after move

@aanthony-rp aanthony-rp merged commit 0b32183 into redpanda-data:dev Jul 5, 2024
13 of 16 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v24.1.x

@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Jul 5, 2024

skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51160#019083d8-685b-4487-a46e-5170a19af9cb:
pandatriage cache was not found

skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51160#019083d8-685f-498f-b62b-4823f28f8439:
pandatriage cache was not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants