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>
Bump upstreams Adopt: - odlparent-13.0.1 - yangtools-11.0.0-SNAPSHOT - mdsal-12-0.0-SNAPSHOT Since the format of NormalizedNode tree is updated to not include AugmentationNode (and AugmentationIdentifier), we must force an incompatible update, as we do not have enough information to produce compatible payload. Change-Id: Ibf444540ed052b49651ba66ca7b93c806a6c8a97 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Bump upstream SNAPSHOTS Adopt: - odlparent-10.0.0 - yangtools-8.0.0-SNAPSHOT - mdsal-9.0.0-SNAPSHOT Change-Id: I60991718a6d1ef6f108c2b1f7b2c09b0c5f973c4 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>
Convert to use EffectiveModelContext These are mostly internal changes to eliminate warnings around passing down SchemaContext instead of EffectiveModelContext. Change-Id: I6ef307479abff013b0286e45cf4f822bff6fd6a6 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Migrate from YangInstanceIdentifier.EMPTY This migrates to the replacement empty() method. Change-Id: I32ca026a33835edb16f8e1e6142e9192c880076b Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Fix write transaction shard stats With the changes in ask protocol due to to tell based integration, shards stats had incorrectly reported write transaction counts. Since backend doesnt care about the difference between write-only and read-write transactions and all are read-write from backend point of view we can safely remove writeOnly counter. Change-Id: I18046ad3b229755bbd0daa788a3fe62f59e4140d Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Reduce use of scala.concurrent.duration.Duration In most of the places we really are talking about a FiniteDuration, hence use that class directly where it is an internal detail. Aside from providing clarity, this also reduces potential confusion with java.time.Duration. Change-Id: I57d84c5ca058cfc6fa56ce57ebb0c8d4d3864a3a Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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>
Do not retain initial SchemaContext While looking over a memory dump I have noticed that we retain SchemaContext inside Shard$Builder, which is being retained via Props (which are used to restart the actor). This reference is not updated as the SchemaContext is updated, which means we are wasting memory and are causing Shard to come up with an ancient SchemaContext after a failure. Fix this by having an AtomicReference holder for SchemaContext and have Shard have a Supplier<SchemaContext>. Change-Id: I73fcae46f249d3679522eb7dbbb059e43c5af6c7 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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 unit test CS warnings in sal-distributed-datastore Fixed checkstyle warnings in unit tests. 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) - illegal throwing of Throwable (changed to Exception) - variable name too short - indentation, mostly due to nested code inside anonymous JavaTestKit instances - separator wrapping: '.', '+', '&&' should be on a new line - local vars/params hiding a field - putting overloaded methods close to one another - remove unused vars - convert functional interfaces to lambdas (eclipse save action) - adding final for locals declared too far from first usage Also 3 classes are no longer used so I removed them rather than fix warnings. Change-Id: Ie1507e36c67a2b58f7efb62378212976b962f9fe Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
BUG-5280: expand ShardDataTree to cover transaction mechanics A chunk of ShardCommitCoordinator should actually be implemented by ShardDataTree. This includes transaction queueing, commit timers, interaction with user cohorts and persistence. This patch implements the relevant operations in an message-agnostic, callback-driven way. Fix: ShardDataTreeTest (missing ShardStat MBean) Change-Id: I353bacce8245df85c5f4d6b4cc0ce5416f2f0337 Signed-off-by: Robert Varga <rovarga@cisco.com> Signed-off-by: Vaclav Demcak <vdemcak@cisco.com> 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>
BUG-5626: Eliminate ShardIdentifier.Builder This builder is completely useless, migrate it to static factory methods, which provide equivalent functionality. Change-Id: Ib2b5a1b14cb133bd819b3e163c217a05ed892787 Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-5280: use MemberName instead of String Codebase uses Strings to identify various entities throughout the code. Since we have introduced MemberName as an Identifier, use that instead of a plain string to improve type safety and clarity throughout users. Change-Id: Iace25ef2c7cda0ea94449d1543d4ca73b80fb591 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>