Policy DB contents removed on DB deadlock 22/107422/2
authorliamfallon <liam.fallon@est.tech>
Sun, 10 May 2020 14:53:46 +0000 (15:53 +0100)
committerliamfallon <liam.fallon@est.tech>
Sun, 10 May 2020 21:38:13 +0000 (22:38 +0100)
commit52170568d84bc50ce0119249d387bbf342c2bc7a
treedc73cd9d59624b2c0270c0fbaa7968ac4dad879b
parent59278e17a3911518c5e3601b6a38bfbbcbcf0fc8
Policy DB contents removed on DB deadlock

When a DB deadlock occurs, the DB contents can sometimes be deleted
becasue the DB removes the Service Template object and recreates a new
one in two separate DB transactions.

This change makes sure that the object remove and re-create is in a
sngle DB transaction, so the operation will either happen or not happen
so the DB will not be cleared.

Legacy policy handling must also use the SimpleToscaProvider rather than
accessing the DB directly, as SimpleToscaProvider keeps the DB structure
correct.

Issue-ID: POLICY-2548
Change-Id: I263a41cd1d8bec5d7b421045b3b14aad6e6c66d3
Signed-off-by: liamfallon <liam.fallon@est.tech>
models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaServiceTemplateProvider.java
models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyOperationalTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaServiceTemplateProviderTest.java