Improve orphan transaction logging 31/55931/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 24 Apr 2017 19:51:43 +0000 (21:51 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 24 Apr 2017 19:56:03 +0000 (19:56 +0000)
This patch improves logging when we perform last-resort cleanup
from garbage collector, so that the type of client handle is also
logged. This allows us to discern snapshots and snapshots.

Also lower the logging level to INFO, as this is something that
should be fixed by whoever is causing it, but it does not pose
serious threat to stability.

Change-Id: Iad55c49de87ca73f9671f04f569be7eae0e4f885
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHandle.java

index 6c14297..a01f7a2 100644 (file)
@@ -51,7 +51,7 @@ abstract class ClientBackedTransaction<T extends AbstractClientHandle<?>> extend
         public void finalizeReferent() {
             FINALIZERS.remove(this);
             if (transaction.abort()) {
-                LOG.warn("Aborted orphan transaction {}", transaction.getIdentifier());
+                LOG.info("Aborted orphan transaction {}", transaction);
             }
         }
     }
index b64cf21..4b1d613 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import java.util.Collection;
 import java.util.Map;
@@ -116,4 +117,10 @@ public abstract class AbstractClientHandle<T extends AbstractProxyTransaction> e
         Preconditions.checkState(local != null, "Transaction %s is closed", transactionId);
         return local;
     }
+
+    @Override
+    public final String toString() {
+        return MoreObjects.toStringHelper(this).omitNullValues().add("identifier", transactionId).add("state", state)
+                .toString();
+    }
 }

©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.