diff options
author | Daniel Hanrahan <daniel.hanrahan@est.tech> | 2024-10-16 09:21:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-10-16 09:21:31 +0000 |
commit | 65fce14427d2004cad9d27393411471371cc73f9 (patch) | |
tree | 27832f6f8d761af34e9cd69e8c568712d141de6f | |
parent | b442bc6d6833c855fb85f29ccffc775d80cc49a7 (diff) | |
parent | 426c879645116e22acce507d8e02866944fa0f1c (diff) |
Merge "Added additional logging"
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java index ee555f7dc8..ecbe447226 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java @@ -228,6 +228,9 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService final Collection<String> xpaths = xpathToUpdatedDataNode.keySet(); Collection<FragmentEntity> existingFragmentEntities = getFragmentEntities(anchorEntity, xpaths); + + logMissingXPaths(xpaths, existingFragmentEntities); + existingFragmentEntities = fragmentRepository.prefetchDescendantsOfFragmentEntities( FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS, existingFragmentEntities); @@ -243,6 +246,19 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService } } + private void logMissingXPaths(final Collection<String> xpaths, final Collection<FragmentEntity> + existingFragmentEntities) { + final Set<String> existingXPaths = existingFragmentEntities.stream().map(FragmentEntity::getXpath) + .collect(Collectors.toSet()); + + final Set<String> missingXPaths = xpaths.stream().filter(xpath -> !existingXPaths.contains(xpath)) + .collect(Collectors.toSet()); + + if (!missingXPaths.isEmpty()) { + log.warn("Cannot update data nodes: Target XPaths {} not found in DB.", missingXPaths); + } + } + private void retryUpdateDataNodesIndividually(final AnchorEntity anchorEntity, final Collection<FragmentEntity> fragmentEntities) { final Collection<String> failedXpaths = new HashSet<>(); |