Modernize DataTreeCandidateInputOutput Use local variable type inference and use records. Change-Id: Iac4a7325d922cde24ed9180c2db4dcea09c3b8f4 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Adjust for DataTreeCandidateNode API change The return types have changed, adjust to that. Change-Id: I5c51659e9c0d30ff90cbfff7772d348af301f4f9 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>
Migrate users of Optional.get() We have an incoming enforcement patch, prepare to adopt it. Change-Id: If73abd4ceaea71a216a4bc3a3968b400b508ec38 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>
Translate uint values for old streams When we encounter a commit that was produced before Mg, we know uints are upcasted and hence want to convert values. Same goes for recovery snapshots. JIRA: CONTROLLER-1923 Change-Id: Id22830abaf5adc2d9ca7f5d0233409a971cf0c01 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Expose stream version used for DataTreeCandidate stream We need to properly version the payload stream, as it gives us the view into which version produced it. This allows us to make proper typing assumptions in normalization (and thus pruning). JIRA: CONTROLLER-1923 Change-Id: Iaea995a5ac58e1fba2a4199d3355b321cf9fcff3 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Use yang-data-codec-binfmt yang-data-codec-binfmt now carries migrated code from sal-clustering-commons, make sure we use as much as we can, so that we do not duplicate code. Change-Id: I5d50a63317c2d502c0eb7f71e1e6875cd95d7f9a Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Use ReusableNormalizedNodeReceiver This simplifies some APIs by using ReusableStreamReceiver, as it is an API-level construct rather than a particular implementation. Change-Id: Id9d14d512ac7150a3e71c104577546e219cd86d0 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Add support for reusable streaming With the actual implementations working on top of NormalizedNodeStreamWriter, we gained the ability to flexibly receive stream events. This patch takes advantage of that flexibility by allowing a ReusableImmutableNormalizedNodeStreamWriter to be the receiver of the events -- thus allowing parts of the state involved in building a NormalizedNode tree to be reused -- lowering GC pressure. A number of call sites, which can safely reuse such state are converted to use the newly-introduced facility. Change-Id: Iaf1b3ab2b2996e7004c036fc93a80a8ca8792314 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Bump persisted PayloadVersion Since the NormalizedNodeStream format has changed, shard persisted state is affected. This patch bumps PayloadVersion and applies that bump to snapshots and CommitTransactionPayload. On recovery, a snapshot's need to migrate is reflected in its state, and it is examined just as MigratedSerializables are. CommitTransactionPayload is not examined, as understanding its stream version would require deserializing at least its header. JIRA: CONTROLLER-1888 Change-Id: I678527be4487ee1729123ba8b9dcd2269e6cf262 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Migrate deprecated yangtools method DataTreeCandidateNodes.fromNormalizedNode() has been deprecated in favor of written() -- migrate this user. Change-Id: I355058568c2c1512fbca083142b17a3a515e9329 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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>
Remove deprecated NormalizedNodeInputStreamReader ctor The intent is for NormalizedNodeInputStreamReader to be package-scoped and to create instances via NormalizedNodeInputOutput#newDataInput. Thus the deprecated public constructor was removed and the remaining users were converted to use NormalizedNodeInputOutput#newDataInput. However newDataInput has the side-effect of validating the input stream first which failed for a couple users who need to lazily do the validation so I added a newDataInputWithoutValidation method. Change-Id: Ieb97ab77d05d7a4401dd0526cd4df3a5eafc9eda Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
sal-distributed-datastore Checkstyle fixes (for next version) Even though sal-distributed-datastore currentla already has CS enforcement, these violations don't show up in the build, but I see them as red in Eclipse; I think this must be becaues the CS version used in the Eclipse plugin-in is more recent than the CS used in odlparent, and one of the existing activated checks got a little more stringent. Cleaning this up thus helps both to (a) not have read in Eclipse; (b) pave the way to upgrade Checkstyle in odlparent some day. Change-Id: Ib5649a95a1b26b5791f2c3f3f83924b569f965a2 Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Handle UNMODIFIED type in DataTreeCandidateInputOutput We now replicate DataTreeCandidates with root node type UNMODIFIED however the deserialization in DataTreeCandidateInputOutput throws an ISE with "Unhandled node type 2". The writeDataTreeCandidate method writes the UNMODIFIED type but readDataTreeCandidate needs to handle that case as well. In addition, writeDataTreeCandidate also handles APPEARED and DISAPPEARED but readDataTreeCandidate does not so I made that change as well. Change-Id: I19932e545bbeb95fa10d5f57d43a5780af586285 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: move DataTreeCandidate serialization to its own class This is a useful utility, which can be reused across multiple objects. Split it out into its own class. Change-Id: Ib21abf0ae42e3f70f44b3214039c0f26464bbc3e Signed-off-by: Robert Varga <rovarga@cisco.com>