diff options
author | 2024-04-11 11:59:10 +0200 | |
---|---|---|
committer | 2024-04-11 14:09:22 +0000 | |
commit | 0e1a3ddc9fae2b9ce74be0f14c4f6e08fac7e85b (patch) | |
tree | ba3f884d919ebb334d1b701405a0b1959aa9706a /catalog-dao/src/main/java | |
parent | a542f19d421229508c4408583e552c4c0eba84f1 (diff) |
Fix: Listing archived catalog resources fails randomly1.13.7
- 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 <Fiete.Ostkamp@telekom.de>
Change-Id: Id7a88729c72ac5d3504ca6e3f3097d65475b932b
Diffstat (limited to 'catalog-dao/src/main/java')
-rw-r--r-- | catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java | 24 |
1 files changed, 12 insertions, 12 deletions
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<Iterator<Vertex>, JanusGraphOperationStatus> getCatalogOrArchiveVertices(boolean isCatalog) { - Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { + Either<JanusGraph, JanusGraphOperationStatus> graphEither = janusGraphClient.getGraph(); + if (graphEither.isLeft()) { try { - JanusGraph tGraph = graph.left().value(); - String name = isCatalog ? VertexTypeEnum.CATALOG_ROOT.getName() : VertexTypeEnum.ARCHIVE_ROOT.getName(); - Iterable<JanusGraphVertex> 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<JanusGraphVertex> 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<Vertex> vertices = catalogV.vertices(Direction.OUT, edgeLabel); - return Either.left(vertices); + Iterator<Vertex> 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()); } } |