roryqi opened a new pull request, #11201: URL: https://github.com/apache/gravitino/pull/11201
### What changes were proposed in this pull request? Optimize hierarchical-schema cascade deletion so the number of SQL statements stays bounded regardless of how many descendant schemas exist: - **Relational store** (`SchemaMetaService`): cascade deletion of a `HierarchicalSchema` collects the target schema plus all descendants via a single prefix query, then issues one batched `softDelete...BySchemaIds(List<Long>)` per child-entity table. Unused single-id mapper variants were removed. - **Dispatchers**: `IcebergNamespaceHookDispatcher.dropNamespace` and `SchemaOperationDispatcher.cleanupOrphanedAncestors` previously issued one `store.delete` per orphaned ancestor. They now do a single cascade delete of the outermost orphaned ancestor, which the relational store expands by name prefix. - `TestMemoryEntityStore` now models hierarchical cascade so dispatcher unit tests exercise the real behavior. ### Why are the changes needed? The original hierarchical-schema deletion (#11118, #11175) deleted descendants/ancestors one at a time, producing an unbounded number of SQL statements / transactions for deep or wide hierarchies. Batching bounds the cost. Fix: #9970 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Added/updated unit tests: `TestSchemaMetaService.testDeleteHierarchicalSchemaCascadeRemovesDescendantsAndChildren`, `TestSchemaOperationDispatcher` (orphaned-ancestor cleanup), and `TestIcebergNamespaceHookDispatcher`. Ran `./gradlew :core:test :iceberg:iceberg-rest-server:test -PskipITs` for the affected classes. -- 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]
