BUG-5742: Race condition when creating Application Peer on clustering 95/42295/1
authorClaudio <cgaspari@cisco.com>
Thu, 21 Jul 2016 13:14:13 +0000 (15:14 +0200)
committerClaudio <cgaspari@cisco.com>
Fri, 22 Jul 2016 09:16:25 +0000 (11:16 +0200)
Race condition when creating Application Peer on
a 3 node clustering enviroment.
Fix by use a uninque transaction chain on App Peer.

Change-Id: If6d3fbcb3c4e1e29b24d4921d8f8a64e35f58bb9
Signed-off-by: Claudio <cgaspari@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java

index 2472b5cdf941d1205aab086b40e123589ef006e7..5441e33a0ac4b4dcb5706cdbd7d37d7bd81849ff 100644 (file)
@@ -57,7 +57,6 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol
     private final String name;
     private final YangInstanceIdentifier adjRibsInId;
     private final DOMTransactionChain chain;
-    private final DOMTransactionChain writerChain;
     private final BGPConfigModuleTracker moduleTracker;
     private final EffectiveRibInWriter effectiveRibInWriter;
 
@@ -71,11 +70,10 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol
         final YangInstanceIdentifier peerIId = this.targetRib.getYangRibId().node(Peer.QNAME).node(peerId);
         this.adjRibsInId = peerIId.node(AdjRibIn.QNAME).node(Tables.QNAME);
         this.chain = this.targetRib.createPeerChain(this);
-        this.effectiveRibInWriter = EffectiveRibInWriter.create(this.targetRib.getService(), this.targetRib.createPeerChain(this), peerIId, this.targetRib.getImportPolicyPeerTracker(),
-                this.targetRib.getRibSupportContext(), PeerRole.Internal);
-        this.writerChain = this.targetRib.createPeerChain(this);
-        this.writer = AdjRibInWriter.create(this.targetRib.getYangRibId(), PeerRole.Internal, this.writerChain);
+        this.writer = AdjRibInWriter.create(this.targetRib.getYangRibId(), PeerRole.Internal, this.chain);
         this.writer = this.writer.transform(RouterIds.createPeerId(ipAddress), this.targetRib.getRibSupportContext(), this.targetRib.getLocalTablesKeys(), true);
+        this.effectiveRibInWriter = EffectiveRibInWriter.create(this.targetRib.getService(), this.chain, peerIId, this.targetRib.getImportPolicyPeerTracker(),
+            this.targetRib.getRibSupportContext(), PeerRole.Internal);
         this.moduleTracker = moduleTracker;
         if (moduleTracker != null) {
             moduleTracker.onInstanceCreate();
@@ -184,7 +182,6 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol
         this.effectiveRibInWriter.close();
         this.writer.removePeer();
         this.chain.close();
-        this.writerChain.close();
         if (this.moduleTracker != null) {
             this.moduleTracker.onInstanceClose();
         }