Move operation limiter down to TransactionContextWrapper 47/22147/3
authorRobert Varga <rovarga@cisco.com>
Tue, 19 May 2015 20:04:10 +0000 (22:04 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 9 Jun 2015 12:49:35 +0000 (12:49 +0000)
commitd71b6614d6cdb5a98f086edeb56f5c52f365c61c
tree0d1ced074520df17dd87d4fddabca57f513af2fb
parentf9019d5baf27dfea7bea408df7d8049be19604f8
Move operation limiter down to TransactionContextWrapper

The limiter tracks the number of operations invoked on the shard leader,
which does not correspond to the number of operations executed on the
frontend.

The appropriate entity to decide what is throttled how is the
TransactionContext, which unfortunately may not exist. We will solve
this problem by making TransactionContextWrapper perform pessimistic
limiting as long as the context does not exist. Once the context is
materialized, the outstanding operation queue is handed off to it and
the context becomes the entity managing the limits.

This patch has the side-effect that committing a transaction requires
number of permits equal to the number of shards it touches. It also
ensures that readAll() is properly throttled.

Change-Id: If91816d806bbb3895592e1f42b0b8e389443d0f7
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 9e7a9b3725ad25f9adf85f0ad796b7cf748795a4)
12 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContextFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalThreePhaseCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextWrapper.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionContextImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/LocalTransactionContextTest.java