BUG-5742: Race condition when creating Application Peer on clustering 86/42386/1
authorClaudio <cgaspari@cisco.com>
Thu, 21 Jul 2016 13:14:13 +0000 (15:14 +0200)
committerClaudio <cgaspari@cisco.com>
Sat, 23 Jul 2016 13:03:42 +0000 (15:03 +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 3f4ea3e144df53d242c48c1d292ff1352fc7180d..d2a70074dbc0ab896d66d483d7bf8e7c59a6ec90 100644 (file)
@@ -61,7 +61,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;
     private AdjRibInWriter writer;
@@ -75,13 +74,12 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol
         final YangInstanceIdentifier peerIId = targetRib.getYangRibId().node(Peer.QNAME).node(peerId);
         this.adjRibsInId = peerIId.node(AdjRibIn.QNAME).node(Tables.QNAME);
         this.chain = targetRib.createPeerChain(this);
-        //TODO need to create effective rib in writer with route counter here
-        this.effectiveRibInWriter = EffectiveRibInWriter.create(targetRib.getService(), targetRib.createPeerChain(this), peerIId,
-            targetRib.getImportPolicyPeerTracker(), targetRib.getRibSupportContext(), PeerRole.Internal);
-        this.writerChain = targetRib.createPeerChain(this);
-        this.writer = AdjRibInWriter.create(targetRib.getYangRibId(), PeerRole.Internal, Optional.of(SimpleRoutingPolicy.AnnounceNone), this.writerChain);
+        this.writer = AdjRibInWriter.create(targetRib.getYangRibId(), PeerRole.Internal, Optional.of(SimpleRoutingPolicy.AnnounceNone), this.chain);
         this.writer = this.writer.transform(RouterIds.createPeerId(ipAddress), targetRib.getRibSupportContext(), targetRib.getLocalTablesKeys(),
             Collections.emptyList());
+        //TODO need to create effective rib in writer with route counter here
+        this.effectiveRibInWriter = EffectiveRibInWriter.create(targetRib.getService(), this.chain, peerIId,
+            targetRib.getImportPolicyPeerTracker(), targetRib.getRibSupportContext(), PeerRole.Internal);
         this.moduleTracker = moduleTracker;
         if (moduleTracker != null) {
             moduleTracker.onInstanceCreate();
@@ -190,7 +188,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();
         }