From 32159795628720b76a8ed789f632f9fa68b41603 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Fri, 3 Jun 2022 16:09:46 +0100 Subject: Retry fetch assettoscatemplate in csar generation Change-Id: I328e174d34b1c8fb688510b498d50130827b9608 Issue-ID: SDC-4032 Signed-off-by: MichaelMorris --- .../java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'catalog-dao/src') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java index 3bd318c7b8..998c8eacd1 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.be.dao.cassandra; import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.ConsistencyLevel; import com.datastax.driver.core.Session; import com.datastax.driver.core.SocketOptions; import com.datastax.driver.core.policies.ConstantReconnectionPolicy; @@ -28,6 +29,7 @@ import com.datastax.driver.core.policies.DefaultRetryPolicy; import com.datastax.driver.core.policies.LoadBalancingPolicy; import com.datastax.driver.core.policies.TokenAwarePolicy; import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Mapper.Option; import com.datastax.driver.mapping.MappingManager; import fj.data.Either; import java.util.List; @@ -167,9 +169,14 @@ public class CassandraClient { return Either.right(CassandraOperationStatus.CLUSTER_NOT_CONNECTED); } try { - Mapper mapper = manager.mapper(clazz); + Mapper mapper = manager.mapper(clazz); T result = mapper.get(id); if (result == null) { + logger.info("Failed to get by Id [{}], trying again with consistency level ALL", id); + result = mapper.get(id, Option.consistencyLevel(ConsistencyLevel.ALL)); + } + if (result == null) { + logger.info("Failed to get by Id [{}] with consistency level ALL", id); return Either.right(CassandraOperationStatus.NOT_FOUND); } return Either.left(result); -- cgit 1.2.3-korg