controller.git
2 months agoUse OptionalLong in AbstractClientConnection 05/83005/5
Robert Varga [Wed, 10 Jul 2019 14:02:30 +0000 (16:02 +0200)]
Use OptionalLong in AbstractClientConnection

This removes the need for boxing longs.

Change-Id: I73a6c0be7f9a662f9e1df884f46adbc0fc121fb1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMigrate ShardDataTree to use OptionalLong 04/83004/5
Robert Varga [Wed, 10 Jul 2019 13:54:51 +0000 (15:54 +0200)]
Migrate ShardDataTree to use OptionalLong

This prevents boxing and is more modern than Guava's Optional<Long>.

Change-Id: Iaef3b7f18527f532ed2d775641cd855b14087fc1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMigrate InstallSnapshot/SnapshotTracker use of Optional 03/83003/5
Robert Varga [Wed, 10 Jul 2019 13:38:51 +0000 (15:38 +0200)]
Migrate InstallSnapshot/SnapshotTracker use of Optional

This patch migrates both classes to use Java 8 Optional and
OptionalInt.

Change-Id: Ib8e14f963b4e0db821fd8d3ab37f65b5bf5d5b54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoConvert MessageTracker to use java.util.Optional 02/83002/3
Robert Varga [Wed, 10 Jul 2019 13:30:22 +0000 (15:30 +0200)]
Convert MessageTracker to use java.util.Optional

This migrates from Guava, using Java 8 equivalent.

Change-Id: I71d01dae05e4f426406989d240c12745149d6964
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMigrate ActorUtils to java.util.Optional 01/83001/3
Robert Varga [Wed, 10 Jul 2019 13:20:33 +0000 (15:20 +0200)]
Migrate ActorUtils to java.util.Optional

This migrates ActorUtils to Java 8 Optional, updating its users.

Change-Id: I0ec900d16bf44b2ab8ae48d8a72f2b63fa633312
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse OptionalInt in FlexibleThreadPoolWrapper 00/83000/1
Robert Varga [Wed, 10 Jul 2019 13:11:09 +0000 (15:11 +0200)]
Use OptionalInt in FlexibleThreadPoolWrapper

This gets rid of Guava Optional and fixes an unboxing warning
through use of Java 8.

Change-Id: I9c22bbedfcdd08f18c5ff14283dd8f130d6020c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUpgrade jmh-core 62/82962/4
Robert Varga [Mon, 8 Jul 2019 13:53:29 +0000 (15:53 +0200)]
Upgrade jmh-core

This upgrade jmh-core to the latest release.

Change-Id: I6317ad6689fb5ac6d5156c9e6ddbfb1a6a051321
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMigrate to MD-SAL APIs 63/82963/3
Robert Varga [Mon, 8 Jul 2019 14:02:51 +0000 (16:02 +0200)]
Migrate to MD-SAL APIs

This removes controller dependencies.

Change-Id: Ic3fa0748d4e92f86899af2b8dcf73b7f1ae2560a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDo not depend on odl-mdsal-broker-local 59/82959/2
Robert Varga [Mon, 8 Jul 2019 13:38:03 +0000 (15:38 +0200)]
Do not depend on odl-mdsal-broker-local

odl-mdsal-trace depends on both odl-mdsal-broker (clustered) and
odl-mdsal-broker-local (non-clustered), which is not appropriate.
Remove the latter.

Change-Id: Ifdeb1c242004b6e365c133360c96af00c17c67c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove odl-mdsal-all 58/82958/2
Robert Varga [Mon, 8 Jul 2019 13:35:29 +0000 (15:35 +0200)]
Remove odl-mdsal-all

This set of features was used for testing and does not really
contain 'all' features. Remove it in favor of explicitly listing
dependencies.

Change-Id: I4db4932594c17621ab2fb17f1436531ce3b7dbe5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoTeach sal-remoterpc-connector to route actions 83/82283/13
EmmettCox [Thu, 4 Jul 2019 16:31:38 +0000 (16:31 +0000)]
Teach sal-remoterpc-connector to route actions

sal-remoterpc-connector already handles routing of RPC registrations
and invocations across a cluster. Actions are very similar to RPCs,
hence it is natural to keep both in the same component.

This patch refactors common bits that go into tracking both, so that
we share common actors and concepts.

JIRA: CONTROLLER-1894
Change-Id: I0b9005bc3560b4dd5977a280d83eceebe132bec9
Signed-off-by: EmmettCox <emmett.cox@est.tech>
2 months agoAdd support for reusable streaming 17/82417/8
Robert Varga [Thu, 6 Jun 2019 10:26:37 +0000 (12:26 +0200)]
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>
2 months agoAdd streaming interface to NormalizedNodeDataInput 09/82009/24
Robert Varga [Mon, 13 May 2019 05:44:05 +0000 (07:44 +0200)]
Add streaming interface to NormalizedNodeDataInput

NormalizedNodeDataInput allows reading NormalizedNodes, which is
wired directly to immutable node builders, providing little
flexibility.

This inflexibility requires us to re-stream the data set through
NormalizedNodePruner, effectively doubling memory requirements
during recovery.

Extend NormalizedNodeDataInput to have a NormalizedNodeStreamWriter
to be plugged in, so that the byte stream becomes a source of
NormalizedNodeStreamWriter events, which can be routed through
a custom-built pipeline.

readNormalizedNode() becomes a simple default wrapper, which
pipes the stream into an ImmutableNormalizedNodeStreamWriter.

JIRA: CONTROLLER-1889
Change-Id: Ic732ba9105dd7e27d5612853b931aba66bdd83a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFix multiple snapshots present after journal removal 80/82380/8
Tomas Cere [Mon, 3 Jun 2019 13:02:08 +0000 (15:02 +0200)]
Fix multiple snapshots present after journal removal

After journal removal the sequence number starts counting from 0
once again. Therefore we can have multiple snapshots present and
snapshots with higher sequence number always take priority for loading
even when a newer snapshot is present.

Change this up in 2 ways:
1. disregard sequence number while deleting snapshots(delete all
snapshots with an older timestamp)
2. while loading snapshots prioritize timestamp rather than seqNr.

Also simplify LocalSnapshotStore.compare().

Change-Id: I205ea0ddf48d73b0a09297a1ce4e9fd514531993
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd transaction debugs 58/82858/2
Robert Varga [Mon, 1 Jul 2019 06:50:24 +0000 (08:50 +0200)]
Add transaction debugs

This adds a few debug messages allowing logs to be introspected
to see the timing of readying/applying transactions.

Change-Id: I1dde184023a034c6a0fa30e9a3898ab65db2decc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRename SODIUM versions to NEON_SR2 67/82867/2
Robert Varga [Fri, 28 Jun 2019 11:37:50 +0000 (13:37 +0200)]
Rename SODIUM versions to NEON_SR2

We are shipping these improvements in Neon SR2, which means we
should reserve this version not as Sodium.

Change-Id: If5caa0dd7510c6e1ffe3c483c74c456798ca6bb3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDeprecate all MD-SAL APIs 63/82863/1
Robert Varga [Mon, 1 Jul 2019 11:00:52 +0000 (13:00 +0200)]
Deprecate all MD-SAL APIs

These APIs have either been completely deprecated or have their
replacements in the mdsal project. Mark all of them as deprecated,
including their implementations.

JIRA: CONTROLLER-1902
Change-Id: I903afcef57c70c1013ab479cfcf31a42f475dc0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMake private methods static 62/82862/1
Robert Varga [Mon, 1 Jul 2019 12:12:48 +0000 (14:12 +0200)]
Make private methods static

Eclipse is flagging a number of methods as potentially-static,
make sure we mark them as such.

Change-Id: I4254dd29716f4365d71f81c3f3a0e7a9590d9801
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove ShardManager.configListenerReg 61/82861/1
Robert Varga [Mon, 1 Jul 2019 12:06:28 +0000 (14:06 +0200)]
Remove ShardManager.configListenerReg

This field is not used anywhere, remove it.

Change-Id: Id66143aefea072ce6d529d39e86a961aa1d551ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMigrate use of AbstractDOMStoreTransaction 60/82860/1
Robert Varga [Mon, 1 Jul 2019 12:09:55 +0000 (14:09 +0200)]
Migrate use of AbstractDOMStoreTransaction

This utility class has been migrated to mdsal, use the instance
from there.

Change-Id: I9aad875f631903d4ce9dfb2779dfce6f8883a50c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoReset replyReceivedForOffset correctly 26/82726/1
Tomas Cere [Tue, 25 Jun 2019 12:16:50 +0000 (14:16 +0200)]
Reset replyReceivedForOffset correctly

replyReceivedForOffset needs to be set to the initial -1
otherwise we can have multiple sendSnapshotChunk()'s called
before receiving any replies. Which would fail due to the already
running stopwatch.

Change-Id: Ie708f0c2454a87f77cba97e4fed8a9ffc866b624
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
2 months agoFailed chunks should move offset backwards 25/82725/1
Tomas Cere [Tue, 25 Jun 2019 08:45:15 +0000 (10:45 +0200)]
Failed chunks should move offset backwards

If a chunk has failed it needs to move the offset backwards,
otherwise this would misalign the stream, or make it possible
to call sendNextChunk() right after resend which could be
seen as the chunkTimer attempted to be started while already running.

Change-Id: I6d44195ae9bcb23075ffea9c4f1d1ab1d0540c93
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
3 months agoFix IMDS test synchronization 53/82553/1
Robert Varga [Tue, 18 Jun 2019 15:39:37 +0000 (17:39 +0200)]
Fix IMDS test synchronization

Before we close the DTCL we must make sure we flush all changes,
otherwise we could end up losing changes simply because we are no
longer interested in them.

JIRA: MDSAL-429
Change-Id: I6df384c375ea1692a10c9f460d3dceb626468061
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoReset snapshot progress on IOExceptions 94/82394/6
Tomas Cere [Tue, 4 Jun 2019 09:17:10 +0000 (11:17 +0200)]
Reset snapshot progress on IOExceptions

Also log the whole LeaderInstallSnapshotState of failures.

Change-Id: I33b1c38f2277f08acbe77bcb0c16d2dfe41d8851
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
3 months agoSend commitIndex updates to followers as soon as possible 98/82498/1
Robert Varga [Tue, 11 Jun 2019 13:42:34 +0000 (15:42 +0200)]
Send commitIndex updates to followers as soon as possible

When the commitIndex gets updated when we reach consensus, we should
propagate this fact to the sender peer. Otherwise data tree change
listeners on peers may be unnecessarily delayed, as they end up
waiting for heartbeat interval (or non-batched entries) to be propagated
out.

The results in observably-better behaviour between leader and follower,
as the leader is sending out notifications of consensus, without
delayling for heartbeat -- which is reflected in the changes to
LeaderTest.

Furthermore, DelayedMessagesElectionScenarioTest is detecting the change,
as two members may achieve asynchronous consensus -- hence the leader
would be sending two messages (request to persist, commitIndex) to push
the consensus out. This exposes a race in the test, where we do not know
the order between TimeoutNow and AppendEntries. If AppendEntries is
processed by member 2 after TimeoutNow, leader will know about the new
term due to AppendEntriesReply we send out. The cluster will still
converge, but the assert for leader will be different if it manages to
process the message. Fix this by isolating member 2.

JIRA: CONTROLLER-1900
Change-Id: I695ef25c7a4cf8799c9c5e04c2c33fbf3e2f21df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c2b0e92d2c3ba05abf0fefb24413c68fd1c56bea)

3 months agoSimplify recoveryTime computation 58/82458/3
Robert Varga [Fri, 7 Jun 2019 22:44:58 +0000 (00:44 +0200)]
Simplify recoveryTime computation

Stopwatch.stop() returns self, take advantage of that to shorted
the code to compute the formatting string. Also drop toString()
call, as it is implied by string concat.

Change-Id: I4fa645e42fc38b5f9f0775d986fd17aa693725b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSwitch default output stream version 13/82313/27
Robert Varga [Wed, 29 May 2019 16:17:13 +0000 (18:17 +0200)]
Switch default output stream version

All versioned callers have been converted to use appropriate
stream versions, this patch bumps the default unversioned stream
to Sodium version.

Since we're changing the serialization format for ExecuteRpc,
make sure we fully embrace writer/reader, so that we get better
instantiation.

JIRA: CONTROLLER-1888
Change-Id: I17deeda1a49394600a5b0f93bd46d3b2c812123c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump persisted PayloadVersion 14/82314/25
Robert Varga [Wed, 29 May 2019 16:23:04 +0000 (18:23 +0200)]
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>
3 months agoBump datastore version 11/82311/21
Robert Varga [Wed, 29 May 2019 14:59:01 +0000 (16:59 +0200)]
Bump datastore version

This bumps the ask-based protocol datastore version, so that
SODIUM_VERSION is using Sodium NormalizedNode{Input,Output}.

JIRA: CONTROLLER-1888
Change-Id: Ib4ad1c27566179db958ad7776f81417ab99a78cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd QNameModule coding 26/82426/5
Robert Varga [Thu, 6 Jun 2019 17:36:06 +0000 (19:36 +0200)]
Add QNameModule coding

Coding on QNames is effective when there are a lot of same QNames,
but there are cases where QNames themeselves are not reused --
for example YangInstanceIdentifiers and small read subtrees.

These typically end up using different QNames from a small set
of modules, hence coding modules actually helps them quite a bit.

This patch adds a namespace/revision cache, so that encoding such
QNames is also efficient.

JIRA: CONTROLLER-1898
Change-Id: I6cd0885ef605e4a1bf7b768ffe215e9eb3e2fbc5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd buffering to LocalSnapshotStore 39/82439/3
Tomas Cere [Tue, 4 Jun 2019 13:32:20 +0000 (15:32 +0200)]
Add buffering to LocalSnapshotStore

These improve snapshot save/load load times by around 15-20%
on my environment.

Change-Id: I67236f7e97f519993031d462c947588004857c33
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
3 months agoRemove use of thread-local input 91/82391/9
Robert Varga [Mon, 3 Jun 2019 19:37:43 +0000 (21:37 +0200)]
Remove use of thread-local input

All callers are only called from top-level constructs, thus
not having a relationship with the context in which they are
deserialized.

JIRA: CONTROLLER-1888
Change-Id: I856f9109480fb83475a20ce4430d02a1dd055522
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoTake advantage of AugmentationIdentifier.create() 99/82399/2
Robert Varga [Tue, 4 Jun 2019 17:51:43 +0000 (19:51 +0200)]
Take advantage of AugmentationIdentifier.create()

When we are reading an augmentation identifier for the first
time we can optimize the number of identifiers by consulting
the global weak cache.

JIRA: CONTROLLER-1898
Change-Id: I5cd2d87e0a7c3f01357beb1b097d4a16a6eda3e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not use NodeIdentifierWithPredicates constructors 97/82397/3
Robert Varga [Tue, 4 Jun 2019 17:05:55 +0000 (19:05 +0200)]
Do not use NodeIdentifierWithPredicates constructors

This class will transition into a value-based object for memory
efficiency reasons. Switch to using its static factory methods.

Change-Id: I7e21a6ccf1ad999d2d0427769b26dffeac166274
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoOptimize readQNameSet() 98/82398/2
Robert Varga [Tue, 4 Jun 2019 17:54:22 +0000 (19:54 +0200)]
Optimize readQNameSet()

We are providing a bad hint to HashSet, as we are not taking
into consideration its load factor. Use utility methods from Guava
to get a properly-sized set.

JIRA: CONTROLLER-1898
Change-Id: I568be3040b924a8ed77aa0224ab45673104c4664
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRemove sal-binding-broker dependency on javassist 95/82395/2
Robert Varga [Tue, 4 Jun 2019 12:05:27 +0000 (14:05 +0200)]
Remove sal-binding-broker dependency on javassist

We are not using Javassist anymore, remove the dependency on it.

Change-Id: I46e8f30e002d13d324779f461ac0365b67a6f70a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRemove use of thread-local output 90/82390/6
Robert Varga [Mon, 3 Jun 2019 19:12:44 +0000 (21:12 +0200)]
Remove use of thread-local output

All callers can be safely migrated to using a non-shared writer,
as they all are expected to be apex implementations.

JIRA: CONTROLLER-1888
Change-Id: I87cfa1d3ec415b79c40c29a91ccbd8da2869b27a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump mdsal to 4.0.2 66/82266/6
Robert Varga [Tue, 28 May 2019 07:18:32 +0000 (09:18 +0200)]
Bump mdsal to 4.0.2

This picks up the latest fixes from upstream.

Change-Id: I34ef8d8f5d61c6ca9f795369ab99b06f4488d5f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump yangtools to 3.0.1 65/82265/5
Robert Varga [Tue, 28 May 2019 07:18:08 +0000 (09:18 +0200)]
Bump yangtools to 3.0.1

This bumps yangtools to 3.0.1, picking up latest fixes and
enhancements.

Change-Id: Id7ca8d3e23865070896b9da31e7d09a509b21578
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSwitch CompositeModification to bypass thread-local streams 88/82388/5
Robert Varga [Mon, 3 Jun 2019 17:43:22 +0000 (19:43 +0200)]
Switch CompositeModification to bypass thread-local streams

Thread-local streams have little control over the version being
used, as the stream is allocated all over the place.

This model cannot function without explicit setup, which is used
by CompositeModification. This patch migrates CompositeModification
to use a new NormalizedNodeDataInput-based interface, so
thread-locals become obsolete.

JIRA: CONTROLLER-1888
Change-Id: I1111be5d6fc8c0129fb72232c3e713004068f152
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoMove byte-based serialization method 89/82389/2
Robert Varga [Mon, 3 Jun 2019 18:52:36 +0000 (20:52 +0200)]
Move byte-based serialization method

This is only used in testing, move the method out to testing class.

JIRA: CONTROLLER-1888
Change-Id: Ib18be55467561a2471a74285b062b40d4e9e08c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoMake Modification/Externalizable interface visible 87/82387/1
Robert Varga [Mon, 3 Jun 2019 16:56:44 +0000 (18:56 +0200)]
Make Modification/Externalizable interface visible

Finding direct callers of these methods is not easy, override
them to get exact call sites. This will help us with versioning
of the output stream.

JIRA: CONTROLLER-1888
Change-Id: Idc9bb036fac786b4480c098bd592e272d5a4c0ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRemove ask-based close transaction chain persistence 37/79037/9
Robert Varga [Thu, 23 May 2019 16:57:00 +0000 (18:57 +0200)]
Remove ask-based close transaction chain persistence

ask-based protocol has tracking disabled when encountered, hence
it does not make sense to persist anything.

JIRA: CONTROLLER-1628
Change-Id: I1ec87a9905aa76f3e2a57ae2440c8c693ff60848
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRemove sal-connector-api 79/82379/2
Robert Varga [Mon, 3 Jun 2019 09:18:49 +0000 (11:18 +0200)]
Remove sal-connector-api

This artifact is not used anywhere, remove it.

Change-Id: I43a9df5d77abf28d652ea9289025b49638dad702
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump cds-access-api ABIVersion 12/82312/3
Robert Varga [Wed, 29 May 2019 15:33:08 +0000 (17:33 +0200)]
Bump cds-access-api ABIVersion

In order to take advantage of improvements to NormalizedNode stream,
we need to declare a new ABI version, which will actually use
the new stream version.

JIRA: CONTROLLER-1888
Change-Id: I458a24586888e0b2fcc1c636e16d0b8e9e6e681f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoOptimize NodeIdentifier reading 79/82279/13
Robert Varga [Wed, 29 May 2019 10:10:52 +0000 (12:10 +0200)]
Optimize NodeIdentifier reading

NodeIdentifiers are just an alias for QName, which is heavily
reused. This patch adds a secondary cache for interpreting QNames
as NodeIdentifiers, with instance reuse.

This allows us to reduce the number of NodeIdentifier instances,
while not relying on NodeIdentifier.create() for the common lookup
case.

JIRA: CONTROLLER-1898
Change-Id: Ifa0c5d572f7d39da49707529c7ddd9c9f36f2dab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd support for coded QNames/AugmentationIdentifiers 04/82304/7
Robert Varga [Wed, 29 May 2019 09:27:21 +0000 (11:27 +0200)]
Add support for coded QNames/AugmentationIdentifiers

Profiling is showing we are spending about 46% in readQName(),
which further breaks down to 30% in readCodedString() and 61%
in QNameFactory.create().

Out of 1.7M invocations of readQName(), we end up loading only
508 QNames -- which is understandable, as the number of QNames is
bound by the SchemaContext contents. This also applies to
AugmentationIdentifiers.

This patch defines a new streaming format version, which uses
the same linear coding approach we take for Strings, taking
hash-based lookups out of the hot path -- bringing reconstruction
time down from 36 to 19-24 seconds.

It has also the effect of reducing the snapshot size, in our testing
bringing a 388.8MiB snapshot down to 210.6MiB.

JIRA: CONTROLLER-1898
Change-Id: Ibbc96c286d52b3261b04dd7de02e13bc6b44e803
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSeparate lazy-versioned NormalizedNodeDataInput 78/82278/6
Robert Varga [Tue, 28 May 2019 13:28:55 +0000 (15:28 +0200)]
Separate lazy-versioned NormalizedNodeDataInput

NormalizedNodeInputStreamReader is really only one implementation
of the streaming format, which happens to be bound to LITHIUM_VERSION.

This effectively means NormalizedNodeInputOutput can give out either
a version-bound reader or an unbound reader -- which we facilitate by
creating VersionedNormalizedNodeDataInput which is a simple forwarder
with lazily-initialized delegate.

Since this increases the number of (NormalizedNode)DataInput
implementations, we share as much code as possible through the use
of forwarding implementations.

JIRA: CONTROLLER-1898
Change-Id: I28713346730ed5bf7f912bf8afa5d8722b202035
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not format QNames to string on input 76/82276/4
Robert Varga [Tue, 28 May 2019 11:14:34 +0000 (13:14 +0200)]
Do not format QNames to string on input

Profiling has revelead the creation of String for QNameFactory
lookup is taking around 19% of overall cost of
NormalizedNodeInputStreamReader.readQName().

Rather than using concatenation, use a dedicated Key object, which
holds the separated-out localname/namespace/revision strings,
thus allocating a small object instead of a full-blown String.

This improves snapshot deserialization perfomance on a 350MiB
snapshot by about 16%, also resulting in lower memory pressure.

JIRA: CONTROLLER-1897
Change-Id: If3e9e4b332b0a5acbe33aa10fca189bbc7da8c81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUpdate QNameFactory caching 75/82275/3
Robert Varga [Tue, 28 May 2019 10:42:02 +0000 (12:42 +0200)]
Update QNameFactory caching

This eliminates the use of soft references in favor of weak ones,
so that we do not rely on GC heuristics for retention.

We also make the maximum cache size runtime-configurable via
org.opendaylight.controller.cluster.datastore.node.utils.qname-cache.max-size
property.

Finally we use QName.intern() to defer to the global QName cache,
resulting in better QName instance sharing.

JIRA: CONTROLLER-1897
Change-Id: Ice3596d23b96c4ecfc5775cb21968233b042a984
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix write transaction shard stats 89/82189/3
Tomas Cere [Tue, 21 May 2019 11:42:47 +0000 (13:42 +0200)]
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>
3 months agoUse Files.delete() in LocalSnapshotStore 13/82213/2
Tomas Cere [Thu, 23 May 2019 08:04:16 +0000 (10:04 +0200)]
Use Files.delete() in LocalSnapshotStore

If delete fails, it needs to be logged so change this up.

Change-Id: If4051cb3e5b83dee51f919fc1713cc17f032597e
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
3 months agoDo not enque purges for ask based protocol 37/82137/16
Tomas Cere [Thu, 16 May 2019 12:12:01 +0000 (14:12 +0200)]
Do not enque purges for ask based protocol

With metadata disabled for ask based protocol, there is no need
to purge transaction on the backend and pollute the journal.

Tell based protocol has purges handled by the fronted so it
should be safe for us to remove them on the backend for ask
protocol.

JIRA: CONTROLLER-1879
Change-Id: Ia5c9470782bb4d59b78bbaa605ee5d36c7fb1644
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
3 months agoRemove PersistAbortTransactionPayload 27/82027/14
Tomas Cere [Tue, 14 May 2019 10:56:04 +0000 (12:56 +0200)]
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>
4 months agoDo not leak DataTree from backend actor 82/82182/1
Robert Varga [Tue, 21 May 2019 08:47:34 +0000 (10:47 +0200)]
Do not leak DataTree from backend actor

YANG tools is now exposing the read-only part of DataTree as
ReadOnlyDataTree. Use this interface to restrict the set of
methods accessible to frontend.

Change-Id: I9426d4cee1e68e3cc21f7a39322a0df09739e770
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoDisable transaction tracking for ask-based protocol 40/82140/8
Robert Varga [Thu, 16 May 2019 13:54:29 +0000 (15:54 +0200)]
Disable transaction tracking for ask-based protocol

When we encounter an ask-based protocol message on a leader,
we persist a payload to make sure no state tracking occurs
for that client.

JIRA: CONTROLLER-1879
Change-Id: I3d12a06ce9e5b65ada5b59bde9f9b5486e5e4ef7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
4 months agoAllow transaction tracking to be disabled 83/81983/13
Robert Varga [Fri, 10 May 2019 10:25:31 +0000 (12:25 +0200)]
Allow transaction tracking to be disabled

Ask-based protocol does not need tracking of transactions and
histories, as it is not retransmitting requests. It also does
not inform backend about purely-local aborted transactions
(read-write and read-only), which leads to transaction tracking
rangesets having holes where those IDs are used.

This adds the prerequisite handling of disabling from the leader
without adding the actual mechanics.

JIRA: CONTROLLER-1879
Change-Id: I133e7688b492336937f394f0f6c3f080a05a820f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
4 months agoRemove QueuedNotificationManagerMXBean 71/82171/1
Robert Varga [Mon, 20 May 2019 10:43:49 +0000 (12:43 +0200)]
Remove QueuedNotificationManagerMXBean

This interface is available from yangtools directly, remove
it from controller.

Change-Id: Ic894c0e9fc5d114ebff07bb11f67f1ec67611031
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoDerive config-artifacts from odlparent-lite 71/82071/1
Robert Varga [Wed, 15 May 2019 07:58:52 +0000 (09:58 +0200)]
Derive config-artifacts from odlparent-lite

This is to fix failures seen on promoting to Central.

Change-Id: I6204d68c5144437e5af50bb5f2cb29431841d394
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoBump mdsal to 4.0.1 23/81823/8
Robert Varga [Tue, 30 Apr 2019 10:55:09 +0000 (12:55 +0200)]
Bump mdsal to 4.0.1

Upgrade mdsal to 4.0.1 and remove most references to Javassist
and its associated streamer implementation.

Change-Id: Ia9dc2c886217f1c353db6523b654e993ed9a397a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRemove sal-dom-broker dependency on in-memory datastore 34/81934/5
Robert Varga [Tue, 7 May 2019 10:02:55 +0000 (12:02 +0200)]
Remove sal-dom-broker dependency on in-memory datastore

This dependency should be purely scope=test, so that we do not
depend on a particular datastore.

JIRA: CONTROLLER-1584
Change-Id: I24962d09b80d9f1a68ba777980d129387bc41380
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoSplit odl-mdsal-broker-local and odl-mdsal-broker features 33/81933/4
Robert Varga [Tue, 7 May 2019 09:50:00 +0000 (11:50 +0200)]
Split odl-mdsal-broker-local and odl-mdsal-broker features

These two features are supposed to be exclusive -- either we want
local-only services (-local) or we want clustered services.

JIRA: CONTROLLER-1584
Change-Id: I11c261b6c97471356645826c00ea052ffbe7b82b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoCentralize read{Augmentation,Node}Identifier() methods 08/82008/3
Robert Varga [Mon, 13 May 2019 05:53:27 +0000 (07:53 +0200)]
Centralize read{Augmentation,Node}Identifier() methods

We are using the same construct in multiple places, make sure we
centralize it and mark a FIXME for some efficiency increase.

Change-Id: Ie65089a1a7bb6a2752887498d354a61cb32f0e40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoMigrate deprecated yangtools method 10/82010/2
Robert Varga [Mon, 13 May 2019 07:26:34 +0000 (09:26 +0200)]
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>
4 months agoPoison entries outside of main lock 49/81949/4
Robert Varga [Tue, 7 May 2019 17:42:26 +0000 (19:42 +0200)]
Poison entries outside of main lock

Poisoning entries may involve reaction from their callbacks, which
can attempt to circle back through connections.

Make sure we poison them outside of lock context, so that any
callbacks end up seeing a poisoned connection, but without the lock
being held -- hence the locks can be acquired in-order.

JIRA: CONTROLLER-1893
Change-Id: I26551d052307812e76f3e45024a77dbb83312b17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAllow SnapshotBackedReadTransaction customization 55/81955/1
Robert Varga [Wed, 8 May 2019 10:28:24 +0000 (12:28 +0200)]
Allow SnapshotBackedReadTransaction customization

In some specific cases we need to customize abort-like handling,
which is already implemented for write-like transactions, but is
not present for read-only transaction.

This patch adds the capability to attach a close() handler and
makes sure AbstractSnapshotBackedTransactionChain takes advantage
of it.

JIRA: CONTROLLER-1879
Change-Id: Ic7027956556b5dd25120ee81613a6151e5dbc501
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoEnqueue purge snapshot directly 45/81945/1
Robert Varga [Tue, 7 May 2019 14:23:19 +0000 (16:23 +0200)]
Enqueue purge snapshot directly

When we are sending abort+purge, make sure we propagate it out
as soon as possible.

Change-Id: I2b63aa20867a8b99b779115f0bb448c0e8ac9a22
JIRA: CONTROLLER-1879
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoMake sure we purge transaction on abort 39/81939/2
Robert Varga [Tue, 7 May 2019 11:22:10 +0000 (13:22 +0200)]
Make sure we purge transaction on abort

In case of read-only transactions it is not sufficient to just
persist the abort payload, we need to also purge the transaction.

Change-Id: I8761040d074743b5a1c5eebbecc6449c30abe47e
JIRA: CONTROLLER-1879
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRefactor odl-mdsal-remoterpc-connector 17/81917/4
Robert Varga [Mon, 6 May 2019 17:48:51 +0000 (19:48 +0200)]
Refactor odl-mdsal-remoterpc-connector

RPC connector has a logical dependency on components present
in the distributed datastore. This refactors it to take that
into account.

JIRA: CONTROLLER-1584
Change-Id: Icd0145b35310133822ee02cdf4a3d4cffbc6e257
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRefactor odl-mdsal-distributed-datastore 16/81916/3
Robert Varga [Mon, 6 May 2019 18:04:10 +0000 (20:04 +0200)]
Refactor odl-mdsal-distributed-datastore

odl-mdsal-distributed-datastore forms the baseline for supporting
akka-based cluster. This refactors it to pull its dependencies in
so it can be properly tested.

This also moves CommitStatsMXBean, so we do not depend on controller's
broker at all.

Finally we co-locate all configuration files into this feature, so
it can boot up.

JIRA: CONTROLLER-1584
Change-Id: I9319de78d61d63e3c49825e940af5c8c70657185
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoSplit out odl-controller-blueprint 14/81914/2
Robert Varga [Mon, 6 May 2019 17:39:00 +0000 (19:39 +0200)]
Split out odl-controller-blueprint

Blueprint only needs controller APIs, it does not need implementation
and it should be packaged in odl-config-netty.

This patch splits it out in a separately-tested feature

JIRA: CONTROLLER-1584
Change-Id: I4b12a3880b32fc21515dbb1e69f7e21b7c4d5c57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRefactor odl-mdsal-clustering-commons 13/81913/2
Robert Varga [Mon, 6 May 2019 16:41:46 +0000 (18:41 +0200)]
Refactor odl-mdsal-clustering-commons

odl-mdsal-clustering-commons does not have a dependency on
odl-mdsal-broker-local, hence we can factor it out to pull in
its upstream dependencies, thus fixing its tests.

JIRA: CONTROLLER-1584
Change-Id: Ie1df487329df8ea1295e0e2dc3b0e0f07e2e4037
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoSplit out odl-controller-binding-api 12/81912/2
Robert Varga [Mon, 6 May 2019 16:32:43 +0000 (18:32 +0200)]
Split out odl-controller-binding-api

This refactors packaging so that we package Binding-level APIs
in a corresponding feature -- mirroring MD-SAL's setup.

JIRA: CONTROLLER-1584
Change-Id: I92adc8f14462633a253136d6c37e708a30cc4a37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoReset snapshot progress after timeout has been hit 16/81816/7
Tomas Cere [Tue, 30 Apr 2019 08:49:02 +0000 (10:49 +0200)]
Reset snapshot progress after timeout has been hit

Add a stopwatch to LeaderInstallSnapshotState that allows
us to keep track whether a follower took too much time to respond
to InstallSnapshot for whatever reason allowing us to retry
chunks that time out.

JIRA: CONTROLLER-1891
Change-Id: Id443a4cc7a069ad4d9982d537d9a8d82b845ac35
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
4 months agoSplit out odl-controller-dom-api 11/81911/1
Robert Varga [Mon, 6 May 2019 16:12:41 +0000 (18:12 +0200)]
Split out odl-controller-dom-api

This refactors packaging so that we package DOM-level APIs
in a corresponding feature -- mirroring MD-SAL's setup. We also fix
dependencies on MD-SAL features to use ranges instead of fixed
versions.

JIRA: CONTROLLER-1584
Change-Id: Ib5e0649552b34662a91b4fb32da9af69f589bb6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoFix memory leak in BA mount service 91/81891/5
Maros Marsalek [Fri, 3 May 2019 12:04:56 +0000 (14:04 +0200)]
Fix memory leak in BA mount service

The cache used in BA mount service uses weakKeys() so the keys (DOM mountpoint)
could be GCed when no ono, except cache, referenced them).
However the values in the cache (BA mountpoint) also kept a reference to
the key, so the key was never weakly reachable and thus never GCed
resulting in a memory leak.

Which is especially visible in case of frequent reconnects of netconf
mountpoints where after every reconnect a new DOM mountpoint is created,
requiring a new BA mountpoint creating new entry in the cache of BA mount service...

Added also a simple test verifying proper cache cleanup

Change-Id: I9c109dd6d499d6185842d6a1ad5a59d75565af5c
Signed-off-by: Maros Marsalek <mmarsalek@frinx.io>
4 months agoImprove segmented journal JMX beans 90/81890/1
Robert Varga [Fri, 3 May 2019 11:01:14 +0000 (13:01 +0200)]
Improve segmented journal JMX beans

This patch updates metric naming to properly tie them to individual
journals -- so that the statistics are actually useful.

JIRA: CONTROLLER-1884
Change-Id: I6f4f398894860566e234562d731462535b62801e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoChange segmented journal naming 89/81889/1
Robert Varga [Fri, 3 May 2019 10:48:34 +0000 (12:48 +0200)]
Change segmented journal naming

Using Base64 encoding is not quite nice for debugging purposes,
use URLEncoder, so that we are consistent with snapshot store

JIRA: CONTROLLER-1884
Change-Id: I55f7bef79b7d5c14ab10180444770fedcc23eab9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoHarden ShardCommitCoordinator to survive EOS write retries 90/81790/1
Tomas Cere [Fri, 26 Apr 2019 10:37:38 +0000 (12:37 +0200)]
Harden ShardCommitCoordinator to survive EOS write retries

EntityOwnershipShard can break the usual shard rule of only one 3PC
running at one time, causing the retrying write attempting to modify
an already sealed modification.

Change-Id: Iaa56b68a30f9191f7aa14428f39d4d7524aeb09d
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
5 months agoDo not allow persistence callbacks to throw Exception 40/81640/6
Robert Varga [Sat, 13 Apr 2019 12:55:13 +0000 (14:55 +0200)]
Do not allow persistence callbacks to throw Exception

Since we are indirecting through an executor, we are forced
to wrap any exception -- just do not bother, as the callbacks
are executed in the context of an actor anyway (dealing with
RuntimeExceptions) and users are not throwing checked exceptions.

Change-Id: I6cea19ab7192fa42ad3c346d554411cd0d558a64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoBump mdsal to 4.0.0 30/81130/38
Robert Varga [Fri, 22 Mar 2019 18:33:21 +0000 (19:33 +0100)]
Bump mdsal to 4.0.0

This bumps mdsal to 4.0.0, adjusting for changes it brings, notably:
- FluentFuture removed from DOM RPC invocation services
- ping-pong functionality directly part of DOMDataBroker API and not
  via a dedicated DOMDataBroker instance
- DataContainer.getImplementedInterface() renamed to
  implementedInterface()
- DOMBrokerReadWriteTransaction.close() method being removed
- BindingCodecTreeNode being refactored

Change-Id: I5af13aa82036373826291a54661f7fd20ff387c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoBump yangtools to 3.0.0 29/81129/31
Robert Varga [Fri, 22 Mar 2019 18:32:29 +0000 (19:32 +0100)]
Bump yangtools to 3.0.0

This is bumps yangtools to 3.0.0, adjusting for changed APIs. The
changes specifically include:

- use ListenerRegistry.getRegistrations() instead of it implementing
  Iterable
- adjust for NormalizedNodeStreamWriter interface change
- remove use of *AttrBuilder, as NormalizedNodes no longer hold
  attributes
- DataTreeCandidateNodes.empty() instead of home-grown implementation
- adjust for DataTreeCandidateNode.getModifiedChild() returning Optional
- use QueuedNotificationManager.BatchedInvoker

Change-Id: Ia30d73ccf6380e3759414b3026b822df0950a481
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoBump odlparent to 5.0.0 28/81128/25
Robert Varga [Fri, 22 Mar 2019 18:31:50 +0000 (19:31 +0100)]
Bump odlparent to 5.0.0

This bumps odlparent references to 5.0.0, removing use of the JSR305
remnants. Also a useless javadoc plugin override is removed.

Change-Id: Iae5355e49115afdd73b60bd26ac85f7f542bbff8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoDo not break actor containment 82/81482/7
Tomas Cere [Tue, 9 Apr 2019 08:46:18 +0000 (10:46 +0200)]
Do not break actor containment

During async persistence the actor containment is broken which
results in applyState being called directly from the persistence actor.
This means that the ClientRequestTracker might be missing an entry
for the transaction and the transaction being applied as a foreign candidate
in ShardDataTree.
If this happens there will be a transaction stuck in COMMIT_PENDING state,
blocking any further progress in the shard until its restarted.

JIRA: CONTROLLER-1890
Change-Id: I944b233d13103df08b68baeaf3907c064d1d526e
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoIntegrate SegmentedJournalActor with metrics/JMX 53/81353/1
Robert Varga [Tue, 2 Apr 2019 21:40:20 +0000 (23:40 +0200)]
Integrate SegmentedJournalActor with metrics/JMX

This adds the wiring needed to expose segmented journal metrics
through JMX.

JIRA: CONTROLLER-1884
Change-Id: I42f0b29985410a34ec91639ce8be2903bbe7dd5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoFixup HTML5 javadoc compatibility 39/81339/1
Robert Varga [Mon, 1 Apr 2019 18:05:15 +0000 (20:05 +0200)]
Fixup HTML5 javadoc compatibility

This fixes use of 'summary' attribute.

Change-Id: I872afdef8b678a68f4e1781330c3f11f0e010925
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoMigrate nullness annotations 18/81318/2
Robert Varga [Fri, 29 Mar 2019 01:53:09 +0000 (02:53 +0100)]
Migrate nullness annotations

This mass-migrates sal-distributed-datastore to use JDT nullness
annotations instead of JSR305.

Change-Id: I2cd739e3db8c074a55e335e17297a23065775d6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoMigrate to AbstractActor 96/80396/8
Robert Varga [Tue, 19 Feb 2019 14:58:28 +0000 (15:58 +0100)]
Migrate to AbstractActor

UntypedActor has been deprecated, this patch migrates to using
AbstractActor so we eliminate a slew of deprecatation warnings.

Change-Id: I4e3274ce92d5f68df1937f91f823eed905da4d6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ajay Lele <ajayslele@gmail.com>
5 months agoFix checkstyle in toaster-it 69/81269/1
Robert Varga [Thu, 28 Mar 2019 18:54:43 +0000 (19:54 +0100)]
Fix checkstyle in toaster-it

Simple whitespace cleanup to keep checkstyle happy.

Change-Id: Id51f7b87b632cce92c29cbae8794662fe6feb250
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoFix transaction mocking 62/81262/1
Robert Varga [Thu, 28 Mar 2019 16:55:17 +0000 (17:55 +0100)]
Fix transaction mocking

We should not confuse FluentFutures and CheckedFutures, as the latter
is deprecated and with Guava 27 they are not compatible anyway.

Change-Id: I7489b4470df6fa435aab190b6e38eaf154522fe7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoMigrate to use openCursor() 61/81261/1
Robert Varga [Thu, 28 Mar 2019 16:26:24 +0000 (17:26 +0100)]
Migrate to use openCursor()

createCursor() has been deprecated long time ago, use its replacement
instead.

Change-Id: Id8862470ca4ad8c9fdec5c05cbac044c6715e153
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoFix logging messages 60/81260/5
Robert Varga [Thu, 28 Mar 2019 13:32:44 +0000 (14:32 +0100)]
Fix logging messages

Upgraded spotbugs is finding more violations, fix them up.

Change-Id: I8956c5b7a6eef38286f4c2b6fb07ca6a775e6965
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoUse ReusableNormalizedNodePruner in PruningDataTreeModification 58/81258/5
Robert Varga [Thu, 28 Mar 2019 12:01:48 +0000 (13:01 +0100)]
Use ReusableNormalizedNodePruner in PruningDataTreeModification

Rather than instantiating a pruner for each invocation, keep an
instance around for reuse. In order to facilitate free-standing
modifications, we also keep a reference to the DataSchemaContextTree
bound our current SchemaContext.

JIRA: CONTROLLER-1887
Change-Id: I5d310b12feb1ff46dc2af0e67294a925d48a4957
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoAdd ReusableNormalizedNodePruner 57/81257/4
Robert Varga [Thu, 28 Mar 2019 11:46:34 +0000 (12:46 +0100)]
Add ReusableNormalizedNodePruner

This version of NormalizedNodePruner is reusable across invocations,
and improving CPU and memory efficiency in bulk operations due to
not needing to allocate stack nor lookup DataSchemaContextTree.

JIRA: CONTROLLER-1887
Change-Id: I1798f5f6255cd23702bf3792c1f4f5149f92d208
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoMove checkNotSealed() to addBuilder() 51/81251/2
Robert Varga [Thu, 28 Mar 2019 10:22:55 +0000 (11:22 +0100)]
Move checkNotSealed() to addBuilder()

addBuilder() is called after previous check for seal from all callers,
who do not have any side-effects aside allocating arguments to
addBuilder().

Move the call to checkNotSealed() to addBuilder(), making the code
more straightforward and possibly preventing bugs from creeping in.

JIRA: CONTROLLER-1887
Change-Id: I127385378957deb7f38f1203870a0e52cd630644
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoRemove NormalizedNodePruner.findSchemaNodeForNodePath() 50/81250/2
Robert Varga [Thu, 28 Mar 2019 10:16:27 +0000 (11:16 +0100)]
Remove NormalizedNodePruner.findSchemaNodeForNodePath()

DataSchemaContextTree.findChild() provides equivalent functionality,
so use that instead of brewing our own.

JIRA: CONTROLLER-1887
Change-Id: Ia55ac99ce8fa37daf06ce0e7e1615f1bd0a07123
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoDo not use Optional in NormalizedNodeWrapper 49/81249/2
Robert Varga [Thu, 28 Mar 2019 09:58:49 +0000 (10:58 +0100)]
Do not use Optional in NormalizedNodeWrapper

Use nullable schema instead, as the caller is package-private and
ends up unpacking the return anyway. This simplifies
NormalizedNodePruner a bit.

JIRA: CONTROLLER-1887
Change-Id: I395dd8266bd7198f66890c4ae3633ecda9281726
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoHide NormalizedNodeBuilderWrapper 48/81248/2
Robert Varga [Thu, 28 Mar 2019 07:48:02 +0000 (08:48 +0100)]
Hide NormalizedNodeBuilderWrapper

This class is not instantiable outside of the package is it does
not leak from NormalizedNodePruner -- therefore it cannot be used
by anyone else. Make sure it's package-private and clean it up
a bit.

JIRA: CONTROLLER-1887
Change-Id: I17911508273d68c2795d38e2156c9407522f55fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoRemove NormalizedNodePruner.SimpleStack 34/81234/2
Robert Varga [Wed, 27 Mar 2019 22:51:57 +0000 (23:51 +0100)]
Remove NormalizedNodePruner.SimpleStack

This custom implementation is highly inefficient, because:
1) peek/pop operations perform get(int) and remove(int) operations
   on ArrayList, which are highly inefficient O(N)
2) it allocates an object for each entry

Replace this class with a stock Deque, which takes care of the first
problem, as push/pop/peek are amortized O(1).

For implementation use an ArrayDeque, which takes care of the second
problem, as stack entries are reused.

Change-Id: Ie59e2fb47f841e4e5fc08c3ab7e164ad0cb368ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoClean up NormalizedNodePruner 33/81233/1
Robert Varga [Wed, 27 Mar 2019 22:45:15 +0000 (23:45 +0100)]
Clean up NormalizedNodePruner

- shorten YangInstanceIdentifier.PathArgument references
- do not declare runtime exceptions as thrown
- use a space after comma

Change-Id: Id0f09d2cd72bc619331c2d16e8f184db784c9976
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.