Deprecate ask-based protocol messages Since we have removed the ask-based client, we really have no way of testing ask-based messages' interaction with Shard. We keep Shard compatible, but deprecate all ask-based messages and methods/classes dealing with them on the backend. JIRA: CONTROLLER-2054 Change-Id: I5764713b686ae11f8d750e691576b6d20637ab7d Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Move MXBean definitions to cds-mgmt-api Downstreams are very interested in the details of CDS operation and end up going through all kinds of hoops to get at the information exposed in our MXBeans. They mostly do that without touching the definition itself, so let's make it easier and publish the definitions in an API artifact. We also end up evacuating implementations to the packages that expose them, hiding them from plain sight. Since we want them to really be final, also adjust tests which are mocking them for no good reason. JIRA: CONTROLLER-1965 Change-Id: I9bb1eb792c7ce4b7197b4da715c2c5223b41ff73 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Migrate Props.create() call sites Props.create() now takes a class identifying the class being instantiated. Fix callsites to do that. Change-Id: I4a0169663465b0c1ba62fc87ca13423cf5a4464f Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Fix modernization issues This fixes issues pointed out by Modernizer, which mostly boil down to using Objects.requireNonNull() and direct java.util collections. Change-Id: Id32530a6722cd101f96c23f6a745f91b2f09e2f9 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Remove PersistAbortTransactionPayload With the metadata tracking disabled for ask based protocol there is no need to track aborts for read only transactions on the backend. JIRA: CONTROLLER-1879 Change-Id: I189ae3231bb2f3c0eaa0bbe21a14342446708c5f Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Remove unused exceptions This drops exception declarations which are never used. Change-Id: Icc8938b9c3b437a0d5961ec1b481fd06c52d47f2 Signed-off-by: Stephen Kitt <skitt@redhat.com>
Adjust to mdsal DOM read/exists FluentFuture change This patch needs to be coordinated with https://git.opendaylight.org/gerrit/#/c/74127/. Change-Id: Iceeff9f9f75ca40ebc31bd839b5e6a5c8639aa4c Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Adjust to yangtools-2.0.0 changes Change-Id: Ib86747e5ed19c0c00bb46b8d7e4936f4d90c4364 Signed-off-by: Robert Varga <robert.varga@pantheon.tech> Signed-off-by: Stephen Kitt <skitt@redhat.com>
Fix sonar warnings in sal-distributed-datastore These come from squid: - String literals should not be duplicated - Modifiers should be declared in the correct order - Lambdas and anonymous classes should not have too many lines - Nested blocks of code should not be left empty - Local variables should not shadow class fields - Exception handlers should preserve the original exception - Utility classes should not have public constructors - Overriding methods should do more than simply call the same method in the super class - Unused private fields should be removed I fixed quite a few of them. Others we'd have to suppress or modify the sonar config to be more lenient. Change-Id: I7ce7b2a05feac9844fd9c37927de82b7b8b68ee5 Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
BUG-8027: do not break actor encapsulation Invoking abort() from ShardTransaction means we are executing code from one actor in the context of another one and since the code path involves persistence, this breaks Akka rather thoroughly. Introduce a dedicated method for the required upcall and send a request to persist separately. Change-Id: Ic994b5e5963e8c602844e283f34df8bfa3726705 Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-5280: add frontend state lifecycle When transitioning between roles we need to take care of proper handling of state known about frontend. This patch adds the leader/non-leader transitions, creating the state from FrontendMetadata and forgetting it when transactions are committed. Our replicated log needs to grow more entries to accurately replicate the state of the conversation between the frontend and backend, so if a member becomes the leader it has an understanding of which transactions and transaction chains have been completed (aborted, committed, purged). These are replicated before a response is sent to the frontend, so if a leader before they replicate successfully, the frontend will see them as a timeout and retry them (and be routed to the new leader). Both leader and followers are expected to keep the metadata handy: the leader keeps for the purpose of being able to generate a summarized snapshot. The followers keep it so their metadata view is consistent with the contents of the data tree. Change-Id: I72eea91ee84716cdd8a6a3521b42cca9a9393aff Signed-off-by: Robert Varga <rovarga@cisco.com>
Fix FindBugs warnings in sal-distributed-datastore and enable enforcement Several warnings were suppressed via annotation with justification provided. Other warnings that were fixed: - remove redundant implements in several classes - "The referenced methods have names that differ only by capitalization" warnings. This is checked across all classes for consistency. The main offender was getTransactionID vs. getTransactionId. I changed all methods to getTransactionId and associated fields to transactionId. - unsynchronized access to a field where access is synchronized elsewhere (in DataTreeChangeListenerProxy and DatastoreContextIntrospector). - catching Exception instead of catching more specific exception types that are thrown from the try block. - unconfirmed casts - verify via Preconditions check to avoid warning - unnecessarily calling toString() on a String instance - synchronizing an AtomicInteger instance (in ThreePhaseCommitCohortProxy) - not an issue in this case but changed to synchronize a separate Object in lieu of supressing the warning. - unsynchronized to SimpleDateFormat which isn't thread-safe (in ShardStats). - potential null-pointer access of 'shard' in ShardStats - changed to pass 'shard' to the ctor in lieu of setter. - calling String#getBytes w/o specifying encoding (in DataTreeModificationOutput). - privileged access to create ClassLoader in ActorSystemProviderImpl although not likely a SecurityManager would ever be present. Change-Id: I0a87208f3f200fbe4f78e950c21419fbab154d94 Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Fix warnings/javadocs in sal-distributed-datastore First off, I apologize for the size of this patch. There's a ton of classes in this project and I didn't even get to all of them (will follow-up). While a lot of files were touched, the changes were mostly small. Fixed a lot of checkstyle warnings and cleaned up javadocs. Most of the warnings/changes were for: - white space before if/for/while/catch - white space before beginning brace - line too long - illegal catching of Exception (suppressed) - variable name too short - indentation - missing period after first sentence in javadoc - missing first sentence in javadoc - missing <p/> in javadoc Change-Id: Id56d874a8fbcbbc9285279a71c0a5aba393653a9 Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
BUG-5280: switch transaction IDs from String to TransactionIdentifier This patch switches primary frontend messages to use TransactionIdentifier instead of plain Strings. Change-Id: Ib04a2e4882dfcc43eea5369bf162889fd7ef5472 Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-5280: eliminate ShardTransactionIdentifier This is very simple wrapper class which has two functions: - carries a String transaction identifier (making it available) - prepends it with 'shard-' in its toString() method Analyzing the actual uses of this class revealed that the toString() is called only when instantiating an actor, at which point either the transaction identifier is already present, or a transaction identifier is actually available through AbstractShardDataTreeTransaction. The second case is actually not entirely accurate, as for the case of remotely-created transactions we will actually use the actor name for the transaction name, hence adding to the overall string-induced confusion. Moving the toString() method towards actor instantiation removes the need to pass this class around and we can pass down normal transaction identifiers. This newfound unification allows us to eliminate duplication in the Shard*Transaction classes, which can pick the identifier from AbstractShardDataTreeTransaction, eliminating surface where inconsistencies may be introduced. Change-Id: If05f1bf2e76434d07feab115239addbb4b4bfb91 Signed-off-by: Robert Varga <rovarga@cisco.com>
Ensure AbstractUntypedActor#unknownMessage() is called Our code is silently ignoring messages while there is an abstract method provided for use when a message is not handled. Make sure we document the contract and update implementations to call the method when they encounter an unknown message. Change-Id: I3c75fdb2c154b40c537813dd5a6bab8f47dc95cc Signed-off-by: Robert Varga <rovarga@cisco.com>
Remove clientTxVersion from ShardTransaction With the removal of the pre-Lithium transaction messages, ShardTransaction et al no longer need the clientTxVersion passed on creation so this field was removed. When readying a tx, the version is obtained from the BatchedModifications. Change-Id: I96835f51f3665d205f93f6d98fd9497be5159510 Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Deprecate ReadData/DataExists protobuff messages Deprecated the associated ReadData, DataExists, and DataExistsReply protobuff messages and changed the message classes to extend VersionedExternalizableMessage. Backwards compatibility with pre-boron is maintained. Related code was modified accordingly. Change-Id: Ic9b1e79691ce77aecb36df38c1683deadac0c131 Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Deprecate CloseTransaction protobuff message Deprecated the associated CloseTransaction and CloseTransactionReply protobuff messages and changed the message classes to extend VersionedExternalizableMessage. Backwards compatibility with pre-boron is maintained. Related code was modified accordingly. While the backend sends back the CloseTransactionReply, the transaction front-end doesn't actually use it so I removed the protobuff-related code in CloseTransactionReply as it doesn't matter which serialized version is returned. Change-Id: I42946bbb38c5ff84d05ee0578d8ca9c8f124d5ed Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Remove Helium Tx modify operation messages Removed the following deprecated Helium Tx messages and related code: DeleteData[Reply] MergeData[Reply] WriteData[Reply] ReadyTransaction Also removed the associated protobuf message classes. Change-Id: I6f5db0096a60b50e51bf94b12f38941a4be9ca20 Signed-off-by: Tom Pantelis <tpanteli@brocade.com>