Implementing force delete for catalog and schema#61
Implementing force delete for catalog and schema#61haogang merged 10 commits intounitycatalog:mainfrom
Conversation
| .replace("{full_name}", ApiClient.urlEncode(fullName.toString())); | ||
|
|
||
| localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); | ||
| List<Pair> localVarQueryParams = new ArrayList<>(); |
There was a problem hiding this comment.
Can we move the URL parsing logic to a generic util function?
There was a problem hiding this comment.
This is autogenerated code. Currently we are not changing the client code unless there's an error in the logic.
| try { | ||
| CatalogInfoDAO catalogInfo = getCatalogDAO(session, name); | ||
| if (catalogInfo != null) { | ||
| List<SchemaInfoDAO> schemas = schemaRepository.listSchemas(session, catalogInfo.getId(), Optional.of(100)); |
There was a problem hiding this comment.
Is 100 the page size or the max result? The logic is wrong if it's the max result
It's inefficient to list all schemas when force is not specified. Can we list one schema first to check, and only list others when force is specified?
There was a problem hiding this comment.
Yes, you are correct. 100 currently stands for pageSize. We should leave it empty in order to get all the existing child entities.
I have implemented the similar logic for all entities (level-2, level-3) now :
- First check if a single child entity exists.
- if not
forcethrow exception - else get a list of all child entities of that type by setting
maxResultsas empty/null and delete all of them.
| CatalogInfoDAO catalogInfo = getCatalogDAO(session, name); | ||
| if (catalogInfo != null) { | ||
| List<SchemaInfoDAO> schemas = schemaRepository.listSchemas(session, catalogInfo.getId(), Optional.of(100)); | ||
| if (schemas != null & !schemas.isEmpty()) { |
There was a problem hiding this comment.
thanks, good catch.
| if (schemaInfo != null) { | ||
|
|
||
| // handle tables | ||
| List<TableInfoDAO> tables = tableRepository. |
There was a problem hiding this comment.
It's better to unify the handling for different entity types so that we don't miss new entities types.
There was a problem hiding this comment.
There's no field currently in the db schema to indicate if an entity is level-3 entity (for e.g. table, function, volume). Also there is one different singleton instance of repository associated with each type(i.e.TableRepository, FunctionRepository, VolumeRepository are all different classes and we maintain singletons of each). Given this structure, I am not sure what would be a good way to unify the handling of all entity types.
…existing child entities
* delete schema functionality * prettier
* delete schema functionality * prettier
* delete schema functionality * prettier
PR Checklist
docsis updatedDescription of changes
Related Bug
Solve the linked issue
Testing
Test cases for the above mentioned scenarios have been added and are running fine.