Improve logging around transaction lifecycle 15/56015/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Apr 2017 08:39:21 +0000 (10:39 +0200)
committerStephen Kitt <skitt@redhat.com>
Thu, 27 Apr 2017 15:11:57 +0000 (15:11 +0000)
Testing has shown that we have a gap in request handling and we
have a lot of unclosed transactions. Add logging of code paths
which trigger unsupported request.

Change-Id: I013ba8a141d5a1a9e311a8bca7842ac77064d277
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 63d615831603b7a0a11b173f9d9316641e880844)

opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendReadOnlyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendReadWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LeaderFrontendState.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java

index a3cffd1..071fded 100644 (file)
@@ -23,6 +23,8 @@ import org.opendaylight.controller.cluster.access.concepts.RequestEnvelope;
 import org.opendaylight.controller.cluster.access.concepts.RequestException;
 import org.opendaylight.controller.cluster.access.concepts.UnsupportedRequestException;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Read-only frontend transaction state as observed by the shard leader.
@@ -31,6 +33,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  */
 @NotThreadSafe
 final class FrontendReadOnlyTransaction extends FrontendTransaction {
+    private static final Logger LOG = LoggerFactory.getLogger(FrontendReadOnlyTransaction.class);
+
     private final ReadOnlyShardDataTreeTransaction openTransaction;
 
     private FrontendReadOnlyTransaction(final AbstractFrontendHistory history,
@@ -56,6 +60,7 @@ final class FrontendReadOnlyTransaction extends FrontendTransaction {
             handleTransactionAbort((TransactionAbortRequest) request, envelope, now);
             return null;
         } else {
+            LOG.warn("Rejecting unsupported request {}", request);
             throw new UnsupportedRequestException(request);
         }
     }
index 0990953..ced91b5 100644 (file)
@@ -104,6 +104,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
             handleTransactionAbort((TransactionAbortRequest) request, envelope, now);
             return null;
         } else {
+            LOG.warn("Rejecting unsupported request {}", request);
             throw new UnsupportedRequestException(request);
         }
     }
@@ -314,6 +315,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
                 coordinatedCommit(envelope, now);
                 return null;
             default:
+                LOG.warn("{}: rejecting unsupported protocol {}", history().persistenceId(), maybeProto.get());
                 throw new UnsupportedRequestException(request);
         }
     }
index 2b18123..92b696a 100644 (file)
@@ -113,6 +113,7 @@ final class LeaderFrontendState implements Identifiable<ClientIdentifier> {
             } else if (request instanceof PurgeLocalHistoryRequest) {
                 return handlePurgeHistory((PurgeLocalHistoryRequest)request, envelope, now);
             } else {
+                LOG.warn("{}: rejecting unsupported request {}", persistenceId, request);
                 throw new UnsupportedRequestException(request);
             }
         } finally {
index aca69c2..2b4ff48 100644 (file)
@@ -453,7 +453,7 @@ public class Shard extends RaftActor {
             final ClientIdentifier clientId = lhReq.getTarget().getClientId();
             return getFrontend(clientId).handleLocalHistoryRequest(lhReq, envelope, now);
         } else {
-            LOG.debug("{}: rejecting unsupported request {}", persistenceId(), request);
+            LOG.warn("{}: rejecting unsupported request {}", persistenceId(), request);
             throw new UnsupportedRequestException(request);
         }
     }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.