It is quite common for applications to mis-synchronize transaction
chain closure, which may lead to stale transactions. Unfortunately
the message produced in such situations:
2017-12-21 14:21:56,008 | ERROR | CommitFutures-48 | ExecutionList | 38 - com.google.guava - 18.0.0 | RuntimeException while executing runnable com.google.common.util.concurrent.Futures$6@
6d954ae with executor INSTANCE
java.lang.IllegalStateException: Attempted to close chain with outstanding transaction PingPongTransaction{delegate=org.opendaylight.controller.cluster.databroker.DOMBrokerReadWriteTransaction@
7523c916}
does not give us enough information to correlate the impact of such
failures.
Add AbstractDOMBrokerTransaction.toString(), which results
in the message having actual transaction identifier, so that these
failures can be correlated.
Change-Id: Id4620df4285ec6d3ba24bbcd8f5ab8c1a29e0687
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
package org.opendaylight.controller.cluster.databroker;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.EnumMap;
protected DOMStoreTransactionFactory getTxFactory(LogicalDatastoreType type) {
return storeTxFactories.get(type);
}
+
+ @Override
+ public final String toString() {
+ return addToStringAttributes(MoreObjects.toStringHelper(this).omitNullValues()).toString();
+ }
+
+ protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
+ return toStringHelper.add("identifier", identifier);
+ }
}
package org.opendaylight.controller.cluster.databroker;
+import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
Preconditions.checkState(impl != null, "Transaction %s is no longer running", getIdentifier());
}
+ @Override
+ protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
+ return super.addToStringAttributes(toStringHelper).add("running", commitImpl == null);
+ }
}