yuqi1129 opened a new pull request, #14336: URL: https://github.com/apache/gravitino/pull/14336
### What changes were proposed in this pull request? - `JobMetaService.deleteJob` soft-deletes the job's owner relation in the same transaction. - `JobTemplateMetaService.deleteJobTemplate` soft-deletes the template's owner relation and securable objects, and the owner relations of the jobs deleted with it (new `OwnerMetaMapper.softDeleteOwnerRelOfJobsByTemplateId`). Jobs can't be securable objects, so they have no securable-object rows to clean. - `TableOperationDispatcher.updateColumnsIfNecessary` keeps the stored columns when the catalog reports no column list, instead of treating it as "all columns dropped". - `DTOConverters.toDTO(Table)` keeps `null` columns instead of throwing an NPE. ### Why are the changes needed? - Deleting a job or job template left its owner and privilege rows live until the orphan relation GC collected them, so roles kept listing privileges on deleted templates. - A catalog returning `columns() == null` would have made the load path delete all of a table's columns and their tags, policies and owners. Today the NPE in `toDTO` fails the load first, so this is a defensive fix. Fixes #14335 ### Does this PR introduce _any_ user-facing change? No. Loading a table whose catalog reports no columns now succeeds instead of failing with an NPE. ### How was this patch tested? - New tests: `TestJobMetaService.testDeleteJobCleansOwner`, `TestJobTemplateMetaService.testDeleteJobTemplateCleansOwnersAndPrivileges` (both check that rows of another job or template survive), and `TestTableOperationDispatcher.testLoadKeepsStoredColumnsWhenCatalogReportsNoColumns`. - `TestJobMetaService`, `TestJobTemplateMetaService`, `TestPolicyMetaService` and `TestOwnerMetaService` pass on H2, MySQL and PostgreSQL. `TestTableOperationDispatcher` (45) and `TestDTOConverters` (13) pass. - Each fix was mutation-checked: removing the template relation cleanup, the jobs-by-template owner cleanup, the job owner cleanup, the column guard or the `toDTO` null check makes the matching test fail. -- 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]
