Optimize TransactionProxy for write-only transactions 60/16160/8
authorTom Pantelis <tpanteli@brocade.com>
Sat, 7 Mar 2015 04:40:15 +0000 (23:40 -0500)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 24 Mar 2015 17:37:16 +0000 (13:37 -0400)
commit00cc355c0c58e999ffebd531bca3a507e150e441
tree9e33bf97d80ada7e19d6ada47cc5872f3484572e
parent3e77d4e181b0024936084e10d55ae0d7f285b5ad
Optimize TransactionProxy for write-only transactions

For write-only transactions, modified TransactionProxy to prepare
the Tx modifications directly on the Shard rather than having the
Shard create a separate ShardTransaction actor. The BatchedModifications
messages are sent directly to the shard. On ready, the last
BatchedModifications is flagged as ready, thus also eliminating the
ReadyTransaction message. In this manner, we eliminate the
CreateTransaction and the ReadyTransaction messages and the
the ShardTransaction actor.

Several new fields were added to the BatchedModifications message:
transactionID, transactionChainID, and ready. On the last, readied
BatchedModifications message, the Shard returns the
BatchedModificationsReply message with the cohort actor (the Shard
itself).

The BatchedModifications messages are handled by the
ShardCommitCoordinator. I started creating a separate
ShardTransactionCoordinator but realized I'd have to duplicate some
storage plus the 2 coordinators should have to interface. The
CohortEntry is used to store the prepared DOMStoreWriteTransaction.
Perhaps ShardCommitCoordinator should be renamed to
ShardTransactionCoordinator but that can be refactored later.

I create a DOMTransactionFactory that is used by both the
ShardCommitCoordinator and the Shard to create DOM transactions and
update the mbean stats.

Change-Id: I0d8126149f80854feb504ed9d8e49bcc7db253ce
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
20 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DOMTransactionFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextImpl.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/WriteOnlyTransactionContextImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionContextImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardTransactionIdentifier.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModifications.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModificationsReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/VersionedExternalizableMessage.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModificationsTest.java