Deprecate CreateTransaction protobuff message 42/33142/5
authorTom Pantelis <tpanteli@brocade.com>
Wed, 20 Jan 2016 07:39:53 +0000 (02:39 -0500)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 27 Jan 2016 19:35:22 +0000 (19:35 +0000)
commit3e80db38f7f579505173c29c42f800983d7ca6c1
tree4a07dde3a03a768d87455a8d6adcb6df879e1993
parent7a0fb19fe86fbf7c7bd78f7e522884b6e477b067
Deprecate CreateTransaction protobuff message

Deprecated the associated CreateTransaction and CreateTransactionReply
protobuff messages and changed the message classes to extend
VersionedExternalizableMessage. Backwards compatibility with
pre-boron is maintained. Related code was modified accordingly.

One thing of note is wrt CreateTransactionReply. Previously it had a
version field that represented the leader shard's version. This is used
by the transaction front-end to send the appropriate version for
subsequent messages. However the front-end
RemoteTransactionContextSupport already knows the leader shard's version
from the PrimaryShardInfo which is used for write-only tx's and now the
CreateTransaction message so, to be consistent, it now always uses the
PrimaryShardInfo's version when creating the context instance.

Also I realized that the message versioning would correctly handle
backwards compatibility, ie a newer version sending to an older version,
but not the other way around. So for a newer version, 2, sending to an
older version, 1, the message version would be 1 and would be serialized
in the older format and would be correctly de-serialized on the other
end. However, for an older version, 1, sending to a newer version, 2,
the message version would be 2 but it would be serialized in the older
format and, on the other end, the recipient would see the version as 2
and think it's the newer/current version and it may not de-serialize
correctly. What we really want is to use the lower of the recipient's
version and the sender's version. So I modified the
VersionedExternalizableMessage ctor to do that.

I had to make a change to ShardTransactionChain but then realized it's
no longer used so I just removed it.

Change-Id: I18051c48ec4a8f4251e7acef1e1c24063e53ef24
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
14 files changed:
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/RemoteTransactionContextSupport.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/ShardTransactionChain.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.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/ShardTest.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/PreBoronShardTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreBoronTransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReplyTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionTest.java [new file with mode: 0644]