diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2023-02-14 13:24:40 +0000 |
---|---|---|
committer | danielhanrahan <daniel.hanrahan@est.tech> | 2023-02-15 14:19:42 +0000 |
commit | e28b62148676d189bdd11b78d8d78419d548e358 (patch) | |
tree | 13974274471b6328bc22474358949c87e210687b /cps-ncmp-service/src/main/java/org/onap | |
parent | 9575b84ab4e2db885d8761a98eaae9ff3a06aa81 (diff) |
Bulk delete schemasets in CM handle deregistration
- Batch delete schema sets in single query
- Call deleteUnusedYangResourceModules once per batch, not per CM handle
- Results for deregistering 10k: 14 mins before; 6 mins after
Issue-ID: CPS-1423
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ia3a86a0dc88677323e2f386253a99022a7f02603
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap')
3 files changed, 17 insertions, 2 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index e71b72ab86..508acdc1a3 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -392,7 +392,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } private void batchDeleteCmHandlesFromDbAndModuleSyncMap(final Collection<String> tobeRemovedCmHandles) { - tobeRemovedCmHandles.forEach(inventoryPersistence::deleteSchemaSetWithCascade); + inventoryPersistence.deleteSchemaSetsWithCascade(tobeRemovedCmHandles); inventoryPersistence.deleteDataNodes(mapCmHandleIdsToXpaths(tobeRemovedCmHandles)); tobeRemovedCmHandles.forEach(this::removeDeletedCmHandleFromModuleSyncMap); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java index 10227cf26f..73acf4368d 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java @@ -114,6 +114,13 @@ public interface InventoryPersistence { void deleteSchemaSetWithCascade(String schemaSetName); /** + * Method to delete multiple schema sets. + * + * @param schemaSetNames schema set names + */ + void deleteSchemaSetsWithCascade(Collection<String> schemaSetNames); + + /** * Get data node via xpath. * * @param xpath xpath diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImpl.java index 4d1202b065..2c978950fd 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImpl.java @@ -167,6 +167,14 @@ public class InventoryPersistenceImpl implements InventoryPersistence { } @Override + @Timed(value = "cps.ncmp.inventory.persistence.schemaset.delete.batch", + description = "Time taken to delete multiple schemaset") + public void deleteSchemaSetsWithCascade(final Collection<String> schemaSetNames) { + cpsValidator.validateNameCharacters(schemaSetNames); + cpsModuleService.deleteSchemaSetsWithCascade(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, schemaSetNames); + } + + @Override @Timed(value = "cps.ncmp.inventory.persistence.datanode.get", description = "Time taken to get a data node (from ncmp dmi registry)") public DataNode getDataNode(final String xpath) { @@ -237,4 +245,4 @@ public class InventoryPersistenceImpl implements InventoryPersistence { private static String createCmHandleJsonData(final String cmHandleId) { return "{\"cm-handles\":[" + cmHandleId + "]}"; } -}
\ No newline at end of file +} |