From ee507922fd030c7dd7f068e770ed3073a9b843e6 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 15 May 2014 16:55:02 +0200 Subject: [PATCH] Bug 509: Improve conflict detection of leaf merges Original conflict detection for merge action on leaves only looked at node version and subtree version, which caused the transaction to fail even if the leaf was unmodified and contained the same value. Conflict detection now checks if the leaves are not same, and only in that case it checks for concurrent writes. Change-Id: I5e43233e86adf96e3dad2a93cdcf512b3d17977a Signed-off-by: Tony Tkacik Signed-off-by: Robert Varga --- .../sal/dom/store/impl/SchemaAwareApplyOperation.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaAwareApplyOperation.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaAwareApplyOperation.java index 2af522ea86..afe9653394 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaAwareApplyOperation.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaAwareApplyOperation.java @@ -166,7 +166,16 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper protected void checkMergeApplicable(final InstanceIdentifier path,final NodeModification modification, final Optional current) throws DataPreconditionFailedException { Optional original = modification.getOriginal(); if (original.isPresent() && current.isPresent()) { - checkNotConflicting(path,original.get(), current.get()); + /* + * We need to do conflict detection only and only if the value of leaf changed + * before two transactions. If value of leaf is unchanged between two transactions + * it should not cause transaction to fail, since result of this merge + * leads to same data. + */ + if(!original.get().getData().equals(current.get().getData())) { + + checkNotConflicting(path,original.get(), current.get()); + } } } -- 2.36.6