justinmclean opened a new issue, #9078:
URL: https://github.com/apache/gravitino/issues/9078

   ### What would you like to be improved?
   
   Block non-cascading schema deletions when topics still exist by checking for 
topic metadata and raising an NonEmptyEntityException.
   
   Here is a unit test to help:
   ```
   @Test
     public void testDeleteSchemaFailsWhenTopicExists() throws IOException {
       String metalakeName = "metalake";
       AuditInfo auditInfo =
           
AuditInfo.builder().withCreator("creator").withCreateTime(Instant.now()).build();
   
       BaseMetalake metalake =
           createBaseMakeLake(RandomIdGenerator.INSTANCE.nextId(), 
metalakeName, auditInfo);
       backend.insert(metalake, false);
   
       CatalogEntity catalog =
           createCatalog(
               RandomIdGenerator.INSTANCE.nextId(), Namespace.of(metalakeName), 
"catalog", auditInfo);
       backend.insert(catalog, false);
   
       SchemaEntity schema =
           createSchemaEntity(
               RandomIdGenerator.INSTANCE.nextId(),
               Namespace.of(metalakeName, "catalog"),
               "schema",
               auditInfo);
       backend.insert(schema, false);
   
       TopicEntity topic =
           createTopicEntity(
               RandomIdGenerator.INSTANCE.nextId(),
               Namespace.of(metalakeName, "catalog", "schema"),
               "topic",
               auditInfo);
       backend.insert(topic, false);
   
       Assertions.assertThrows(
           NonEmptyEntityException.class,
           () -> 
SchemaMetaService.getInstance().deleteSchema(schema.nameIdentifier(), false));
     }
   ```
   
   ### How should we improve?
   
   _No response_


-- 
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]

Reply via email to