From 0e1a3ddc9fae2b9ce74be0f14c4f6e08fac7e85b Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Thu, 11 Apr 2024 11:59:10 +0200 Subject: Fix: Listing archived catalog resources fails randomly - filter out vertices that do not have Metadata property when checking if component exists in catalog - log filtered vertex with as much information as possible Issue-ID: SDC-4685 Signed-off-by: Fiete Ostkamp Change-Id: Id7a88729c72ac5d3504ca6e3f3097d65475b932b --- .../sdc/be/dao/janusgraph/JanusGraphDao.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'catalog-dao') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java index 38dc522247..606caeb576 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java @@ -619,31 +619,31 @@ public class JanusGraphDao { } public Either, JanusGraphOperationStatus> getCatalogOrArchiveVertices(boolean isCatalog) { - Either graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { + Either graphEither = janusGraphClient.getGraph(); + if (graphEither.isLeft()) { try { - JanusGraph tGraph = graph.left().value(); - String name = isCatalog ? VertexTypeEnum.CATALOG_ROOT.getName() : VertexTypeEnum.ARCHIVE_ROOT.getName(); - Iterable vCatalogIter = tGraph.query().has(GraphPropertyEnum.LABEL.getProperty(), name).vertices(); - if (vCatalogIter == null) { + JanusGraph graph = graphEither.left().value(); + String vertexType = isCatalog ? VertexTypeEnum.CATALOG_ROOT.getName() : VertexTypeEnum.ARCHIVE_ROOT.getName(); + Iterable vertexIterable = graph.query().has(GraphPropertyEnum.LABEL.getProperty(), vertexType).vertices(); + if (vertexIterable == null) { logger.debug("Failed to fetch catalog vertex"); return Either.right(JanusGraphOperationStatus.GENERAL_ERROR); } - JanusGraphVertex catalogV = vCatalogIter.iterator().next(); - if (catalogV == null) { + JanusGraphVertex catalogVertex = vertexIterable.iterator().next(); + if (catalogVertex == null) { logger.debug("Failed to fetch catalog vertex"); return Either.right(JanusGraphOperationStatus.GENERAL_ERROR); } String edgeLabel = isCatalog ? EdgeLabelEnum.CATALOG_ELEMENT.name() : EdgeLabelEnum.ARCHIVE_ELEMENT.name(); - Iterator vertices = catalogV.vertices(Direction.OUT, edgeLabel); - return Either.left(vertices); + Iterator adjacentVertices = catalogVertex.vertices(Direction.OUT, edgeLabel); + return Either.left(adjacentVertices); } catch (Exception e) { logger.debug("Failed get by criteria: ", e); return Either.right(JanusGraphClient.handleJanusGraphException(e)); } } else { - logger.debug("Failed get by criteria : {}", graph.right().value()); - return Either.right(graph.right().value()); + logger.debug("Failed get by criteria : {}", graphEither.right().value()); + return Either.right(graphEither.right().value()); } } -- cgit 1.2.3-korg