X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractFrontendHistory.java;h=851e500b451a9821ecff55ce0c86d42a0377475c;hb=0a2ed6b43f45b92f09c291e99e2e66a7fa18085f;hp=aef83aee6704a0d26585cf549949d4f1c93a332c;hpb=17a38939f6ba3cbbc1ff0f1f3e00b58f5002813d;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java index aef83aee67..851e500b45 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java @@ -21,6 +21,7 @@ import org.opendaylight.controller.cluster.access.commands.AbstractReadTransacti import org.opendaylight.controller.cluster.access.commands.ClosedTransactionException; import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest; import org.opendaylight.controller.cluster.access.commands.DeadTransactionException; +import org.opendaylight.controller.cluster.access.commands.IncrementTransactionSequenceRequest; import org.opendaylight.controller.cluster.access.commands.LocalHistorySuccess; import org.opendaylight.controller.cluster.access.commands.OutOfOrderRequestException; import org.opendaylight.controller.cluster.access.commands.TransactionPurgeRequest; @@ -44,7 +45,6 @@ import org.slf4j.LoggerFactory; */ abstract class AbstractFrontendHistory implements Identifiable { private static final Logger LOG = LoggerFactory.getLogger(AbstractFrontendHistory.class); - private static final OutOfOrderRequestException UNSEQUENCED_START = new OutOfOrderRequestException(0); private final Map transactions = new HashMap<>(); private final RangeSet purgedTransactions; @@ -137,12 +137,12 @@ abstract class AbstractFrontendHistory implements Identifiable> maybeReplay = tx.replaySequence(request.getSequence()); if (maybeReplay.isPresent()) { final TransactionSuccess replay = maybeReplay.get(); @@ -156,32 +156,33 @@ abstract class AbstractFrontendHistory implements Identifiable { - envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now); - }); + tree.closeTransactionChain(getIdentifier(), + () -> envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now)); } void purge(final long sequence, final RequestEnvelope envelope, final long now) { LOG.debug("{}: purging history {}", persistenceId(), getIdentifier()); - tree.purgeTransactionChain(getIdentifier(), () -> { - envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now); - }); + tree.purgeTransactionChain(getIdentifier(), + () -> envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now)); } private FrontendTransaction createTransaction(final TransactionRequest request, final TransactionIdentifier id) throws RequestException { if (request instanceof CommitLocalTransactionRequest) { LOG.debug("{}: allocating new ready transaction {}", persistenceId(), id); + tree.getStats().incrementReadWriteTransactionCount(); return createReadyTransaction(id, ((CommitLocalTransactionRequest) request).getModification()); } if (request instanceof AbstractReadTransactionRequest) { if (((AbstractReadTransactionRequest) request).isSnapshotOnly()) { - LOG.debug("{}: allocatint new open snapshot {}", persistenceId(), id); + LOG.debug("{}: allocating new open snapshot {}", persistenceId(), id); + tree.getStats().incrementReadOnlyTransactionCount(); return createOpenSnapshot(id); } } LOG.debug("{}: allocating new open transaction {}", persistenceId(), id); + tree.getStats().incrementReadWriteTransactionCount(); return createOpenTransaction(id); } @@ -192,6 +193,9 @@ abstract class AbstractFrontendHistory implements Identifiable