LongerDude opened a new pull request, #9465:
URL: https://github.com/apache/gravitino/pull/9465
## What changes were proposed in this pull request?
This PR implements a check to prevent the deletion of non-cascading schemas
that still contain topic metadata.
## Why are the changes needed?
Currently, schema deletion checks for dependant tables, filesets and models.
If the schema contains topics, the deletion proceeds regardless. Leaving
orphaned topic metadata in the database.
This fix ensures a NonEmptyEntityException is thrown if any active topics
are found within the schema. This matches previous checks for other subschema
entities.
The fix was implemeted in three layers, i tried my best to respect existing
architecture.
Data access layer:
- added sql logic to fetch topic in
TopicMetaBaseSQLProvider.java please note i decided to use count(*) here for
efficieny, calling listTopicsByNamespace would have queryed all topics which
would have to be deserialized, lots of overhead for a simple check.
- added factory method to
TopicMetaSQLProviderFactory.java
- added the method signature to TopicMetaMapper.java
Topic service layer:
- added logic to handle translating the name
identifier into schemaID
Schema service layer:
- added the actual check in the non cascading branch.
Fix: #9078
## Does this PR introduce any user-facing change?
Nothing more than an error message.
## How was this patch tested?
Added testDeleteSchemaNonCascadingFailsWhenTopicExists, to
TestSchemaMetaService.java
./gradlew :core:test
All tests passed.
[#9078] Improvement(core):In SchemaMetaService.java block non-cascading
schema deletions when topics still exist
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]