From 31c976e338645effcee4bbee5147453b3749830f Mon Sep 17 00:00:00 2001 From: Niharika Sharma Date: Tue, 6 Apr 2021 13:43:18 -0400 Subject: Fixed Concurrent Updates overriding the AAI object Issue-ID: AAI-3308 Signed-off-by: Niharika Sharma Change-Id: I7d2d591928987b9f5f9465325fc1c4d03dee3db2 --- .../main/java/org/onap/aai/dbgen/SchemaGenerator.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'aai-core/src/main/java/org') diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java index 37d497ab..9f3e7475 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java @@ -126,6 +126,14 @@ public class SchemaGenerator { graphMgmt.setConsistency(propK, ConsistencyModifier.LOCK); } } + else if (dbPropName.equals("resource-version")) { + String aai_rv_lock_enabled = AAIConfig.get(AAIConstants.AAI_LOCK_RV_ENABLED, "false"); + LOGGER.info(" Info: aai_rv_lock_enabled:" + aai_rv_lock_enabled); + if ("true".equals(aai_rv_lock_enabled)) { + LOGGER.info(" Lock is being set for resource-version Property."); + graphMgmt.setConsistency(propK, ConsistencyModifier.LOCK); + } + } seenProps.put(dbPropName, propK); } else { propK = seenProps.get(dbPropName); @@ -151,6 +159,14 @@ public class SchemaGenerator { graphMgmt.setConsistency(indexG, ConsistencyModifier.LOCK); } } + else if (indexG != null && dbPropName.equals("resource-version")) { + String aai_rv_lock_enabled = AAIConfig.get(AAIConstants.AAI_LOCK_RV_ENABLED, "false"); + LOGGER.info(" Info:: aai_rv_lock_enabled:" + aai_rv_lock_enabled); + if ("true".equals(aai_rv_lock_enabled)) { + LOGGER.info("Lock is being set for resource-version Index."); + graphMgmt.setConsistency(indexG, ConsistencyModifier.LOCK); + } + } } else { LOGGER.info("No index added for PropertyKey: [{}]", dbPropName); } -- cgit 1.2.3-korg