aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiharika Sharma <niharika.sharma@amdocs.com>2021-04-06 13:43:18 -0400
committerNiharika Sharma <niharika.sharma@amdocs.com>2021-04-06 14:54:48 -0400
commit31c976e338645effcee4bbee5147453b3749830f (patch)
tree9db6d1da7b72e44fc5ea25842e21ef4ff57489e7
parent824cde0782a0e785a2ec1cd902863fc299902f8b (diff)
Fixed Concurrent Updates overriding the AAI object
Issue-ID: AAI-3308 Signed-off-by: Niharika Sharma <niharika.sharma@amdocs.com> Change-Id: I7d2d591928987b9f5f9465325fc1c4d03dee3db2
-rw-r--r--aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java16
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConstants.java2
2 files changed, 18 insertions, 0 deletions
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);
}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConstants.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConstants.java
index f44f736c..a1a36189 100644
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConstants.java
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConstants.java
@@ -157,6 +157,8 @@ public final class AAIConstants {
/** Flag to control concurrency lock */
public static final String AAI_LOCK_URI_ENABLED = "aai.lock.uri.enabled";
+ public static final String AAI_LOCK_RV_ENABLED = "aai.lock.rv.enabled";
+
/**
* Instantiates a new AAI constants.
*/