7 years agoBUG-5280: validate FrontendType regular expression 71/39571/9
Robert Varga [Sun, 29 May 2016 18:52:53 +0000 (20:52 +0200)]
BUG-5280: validate FrontendType regular expression

Isolate the regular expresison to a constant so it can be
compile-time tested via @RegEx.

Change-Id: I35277fe1e7c6c741ef286b577bb8da7b165e3481
Signed-off-by: Robert Varga <>
7 years agoBUG-5932: Remove NETCONF startup knobs 66/39366/3
Robert Varga [Tue, 24 May 2016 17:07:25 +0000 (19:07 +0200)]
BUG-5932: Remove NETCONF startup knobs

These options are no longer used by the netconf plugin, remove them.

Change-Id: Idc81c22272c81389c48772bb16bb6a90e1c2a566
Signed-off-by: Robert Varga <>
7 years agoUse configured maximum memory to determine limits 01/37501/3
Robert Varga [Tue, 12 Apr 2016 14:51:59 +0000 (16:51 +0200)]
Use configured maximum memory to determine limits

Use of Runtime.totalMemory() leads to different behavior as memory grows,
meaning we will perform different snapshots based on initial memory sizing
as well as the memory pressures from other parts of the system (which mean
the total memory will grow differently).

Use Runtime.maxMemory() instead, which will cause snapshotting to work
consistently with a fully-used system.

Change-Id: If6e4a135dc0b9a9d4795d1e5d75f7cbc60550c0d
Signed-off-by: Robert Varga <>
7 years agoFix minor bug in ShardManager#removeShardReplica 63/39863/3
Tom Pantelis [Mon, 6 Jun 2016 01:25:07 +0000 (21:25 -0400)]
Fix minor bug in ShardManager#removeShardReplica introdcued a minor bug in
ShardManager#removeShardReplica. The intention was to cleanup
shardReplicaOperationsInProgress on failure so the added line should be
a call to remove and not add.

Change-Id: I36e01f3da75655f39c169c230e9b424a1c6236b9
Signed-off-by: Tom Pantelis <>
7 years agoAdd config system API to recreate a module instance 78/38278/3
Tom Pantelis [Fri, 15 Apr 2016 19:19:50 +0000 (15:19 -0400)]
Add config system API to recreate a module instance

For the blueprint work, I need to be able to restart/recreate a
config module, ie close the previous instance and create a new instance,
when the corresponding service instance is recreated/re-advertised via
blueprint container restart.

The ConfigSubsystemFacade has no API to restart a config module. One
can push a new configuration but there has to be an actual change in
order for a new instance to be created otherwise it reuses the prior

Therefore I added a new EditStrategyType enum, recreate, with a
corresponding EditConfigStrategy class that forces re-creation of a
config module instance. This strategy calls a new
method, reCreateModule, on the ConfigTransactionController interface.

The decision logic to reuse or create a new instance is in the
AbstractModule class and generated derived classes. Therefore the
reCreateModule method sets a canReuseInstance flag on the real
AbstractModule instance. This is probably not the cleanest approach but
I wanted to avoid changing the Module interface as that looked to be too
invasive. The AbstractModule getInstance and canReuse methods check the
canReuseInstance override flag to determine if the old module/instance
can be reused.

Change-Id: I8cfb8408bae0127331676dcf32519b176f0a8844
Signed-off-by: Tom Pantelis <>
7 years agoClean up pom.xml of archetypes projects (not archetypes content) 82/39482/2
Michael Vorburger [Thu, 26 May 2016 12:55:28 +0000 (14:55 +0200)]
Clean up pom.xml of archetypes projects (not archetypes content)

This removes a lot of duplication, which appears to be historical (we
can see that <distributionManagement> is meanwhile defined in
odl-parent; and <scm> in controller parent)

Change-Id: I4f033cb143c3317f86ea8dce2b8398fdb0b526b1
Signed-off-by: Michael Vorburger <>
7 years agoGet rid of old Yang Parser in Controller 45/39645/6
Martin Ciglan [Tue, 31 May 2016 12:46:39 +0000 (14:46 +0200)]
Get rid of old Yang Parser in Controller

- Config part DONE
- MD-SAL part DONE
- bit of clean-up

Change-Id: I6bf4f8b81826d5ab61dd883fff3244f42d148375
Signed-off-by: Martin Ciglan <>
7 years agoAdd src/main/yang as source path in build-helper-maven-plugin 77/39277/2
Michael Vorburger [Mon, 23 May 2016 16:37:21 +0000 (18:37 +0200)]
Add src/main/yang as source path in build-helper-maven-plugin

This is required by yangide so that in-workspace cross-project *.yang
references are correctly resolved; see

Change-Id: I68b7a6961bb42caf7d48d3bfdca0587cc1c1d1ab
Signed-off-by: Michael Vorburger <>
7 years agoRemove M2E lifecycle-mapping <ignore/> for maven-checkstyle-plugin 22/39422/2
Michael Vorburger [Wed, 25 May 2016 15:08:21 +0000 (17:08 +0200)]
Remove M2E lifecycle-mapping <ignore/> for maven-checkstyle-plugin

This blocks Checkstyle for Controller from working in-IDE in  If a
individual developer still wants to disable it, that is still possible
locally, via menu Window > Preferences > Maven > Lifecycle Mapping.

Change-Id: I40d98cba30aa999fafebcbd82c6ea53696e971f0
Signed-off-by: Michael Vorburger <>
7 years agoBUG-5280: optimize identifier serialization format 88/39288/17
Robert Varga [Tue, 24 May 2016 13:17:58 +0000 (15:17 +0200)]
BUG-5280: optimize identifier serialization format

Using ObjectOutput.writeObject() results in large overhead, resulting
in transaction identifiers weighing in at 549 bytes when used in an object.

Introduce WritableObject concept, which has a WriteTo(ObjectOutput) method
and a static factory method readForm(ObjectInput). This effectively means
we do not get Java Serialization headers.

Also make FrontendType a final class, adopting the WritableObject serialization,
which brings down the overhead to below 100 bytes.

Change-Id: I20294d4fdf309f250d507dfc675d8405c1fcf505
Signed-off-by: Robert Varga <>
7 years agoAdd @Ignore to failing test 21/39721/3
Robert Varga [Wed, 1 Jun 2016 15:47:23 +0000 (17:47 +0200)]
Add @Ignore to failing test

Unknown messages are routed to akka and elicit a warning, rendering
this test failing. Somehow this passed through validation, so ignore
the test to resume verify/merge jobs working.

Change-Id: I0adafe1cefa0794a0f6f8df2e4eeb903138af29c
Signed-off-by: Robert Varga <>
7 years agoImplement cluster admin RPCs to change member voting states 86/38086/6
Tom Pantelis [Wed, 20 Apr 2016 15:41:25 +0000 (11:41 -0400)]
Implement cluster admin RPCs to change member voting states

Added 3 new RPCs for changing voting states:

These replace the original ones added in Be that weren't implemented.
They were added as placeholders based on how it was thought it would
work at that time.

New related ShardManager messages were added that are sent by the

The flip-member-voting-states-for-all-shards RPC is a shortcut that
obtains the current voting states via the GetOnDemandRaftState message
to the RaftActor and inverts them. New fields were added to the
OnDemandRaftState response to return the voting states.

Modified the ShardStats JXM bean to report the new OnDemandRaftState

Added a check in RaftActorServerConfigurationSupport to ensure that
there's at least 1 voting member otherwise one can end up with an
unusable shard with no ability to elect a leader.

Fixed a couple bugs in Leader and AbstractLeader that were found during
testing. AbstractLeader needs to take into account the follower's voting
state when determining if the leader is isolated.

Change-Id: I58686e3ce94d58de7cf289e55bb717ba46bc1de5
Signed-off-by: Tom Pantelis <>
7 years agoFormat startup archetype much more nicely, and clean up stuff 75/39175/2
Michael Vorburger [Thu, 19 May 2016 12:55:59 +0000 (14:55 +0200)]
Format startup archetype much more nicely, and clean up stuff

This makes it not have any Checkstyle warnings, and Ctrl-Shift-F Format
Code produce no change (so it's "clean" out of the box)

Change-Id: Ia53e57362c1626df5ed9c01efff4b57c96989fa1
Signed-off-by: Michael Vorburger <>
7 years agoEnforce Java 8 runtime 63/39063/5
Robert Varga [Wed, 18 May 2016 18:25:50 +0000 (20:25 +0200)]
Enforce Java 8 runtime

OpenDaylight Boron release is now supported only with Java 8,
make sure our startup script enforces that.

Change-Id: I03049ebbfadeb9a567f7018d08db47bf370299bb
Signed-off-by: Robert Varga <>
7 years agoEnsure AbstractUntypedActor#unknownMessage() is called 17/36117/9
Robert Varga [Fri, 11 Mar 2016 12:20:53 +0000 (13:20 +0100)]
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 <>
7 years agoBug 5836 - Set namespace for DOM nodes 92/39492/2
Jakub Morvay [Thu, 26 May 2016 14:35:24 +0000 (16:35 +0200)]
Bug 5836 - Set namespace for DOM nodes

Subtree filtering expects nodes with correct namespaces. XML constructed
in config subsystem netconf server does not contain correct namespaces
when in DOM format. Always include namespace when constructing DOM

Change-Id: I4d67f224421b5951fd2a83442870add299e70c1c
Signed-off-by: Jakub Morvay <>
7 years agoRemove duplicate property assignment 83/39483/3
Ryan Goulding [Thu, 26 May 2016 13:13:13 +0000 (09:13 -0400)]
Remove duplicate property assignment

mdsal.version is assigned twice, though it appears the only use of the
property is WRT controller mdsal artifacts.  I have removed the first
assignment, which was overwritten by the second assignment.

Change-Id: I320fa7c4124969ff3a384cf250879cf3f103d664
Signed-off-by: Ryan Goulding <>
7 years agoChange declared exception 09/39409/3
Robert Varga [Wed, 25 May 2016 08:48:49 +0000 (10:48 +0200)]
Change declared exception

fixes a sonar warning: we should declare only specific checked
exceptions, not Exception.

Change-Id: Ibc4baf4db92bcc672284ce6689fbb3747f0efb9e
Signed-off-by: Robert Varga <>
7 years agoUpgrade karaf-resources to 3.0.6 50/39050/2
Stephen Kitt [Wed, 18 May 2016 15:07:59 +0000 (17:07 +0200)]
Upgrade karaf-resources to 3.0.6

Pull in updates from Karaf 3.0.6, and avoid hard-coding the Karaf

Change-Id: I30a58982ff8f2e85efaecc8edbf7979ad5db3c54
Signed-off-by: Stephen Kitt <>
7 years agoBUG-5917: use JVM-internal TransformerFactoryImpl 68/39368/5
Robert Varga [Tue, 24 May 2016 17:15:02 +0000 (19:15 +0200)]
BUG-5917: use JVM-internal TransformerFactoryImpl

This overrides karaf-3.0.6 to enable our XML components to work.

Change-Id: I1d070f9045f57ec15b1d1613a8b83e7a48a9c91e
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: remove ApplyLogEntries 88/38988/5
Robert Varga [Tue, 17 May 2016 16:09:24 +0000 (18:09 +0200)]
BUG-5626: remove ApplyLogEntries

This class has been held back by the now-removed payloads,
hence it is safe to remove.

Change-Id: Ib341dfbf5d4b80b53eb91da57db4a2d80e90d757
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: remove CompositeModification(ByteString)Payload 87/38987/5
Robert Varga [Tue, 17 May 2016 16:01:53 +0000 (18:01 +0200)]
BUG-5626: remove CompositeModification(ByteString)Payload

These payloads have not been emitted since before Lithium and Lithium
codebase performs snapshot on recovery, hence we should not be seeing
these in any supported upgrade scenario. Remove them and related bits
of code.

Change-Id: Ib96fb2d4a516d1235485e2a12c2398c593bfaaba
Signed-off-by: Robert Varga <>
7 years agoUse YangInstanceIdentifier.EMPTY 14/39014/7
Robert Varga [Tue, 17 May 2016 20:58:47 +0000 (22:58 +0200)]
Use YangInstanceIdentifier.EMPTY

While the empty build resolves to the same instance, inline the constant
directly saves a bit of the constant pool and makes it a bit more explicit.

Change-Id: I6c92183f473c551a882d2f2a23b5de13406b1982
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: remove createTypedTransactionActor() 89/38989/5
Robert Varga [Tue, 17 May 2016 13:49:11 +0000 (15:49 +0200)]
BUG-5626: remove createTypedTransactionActor()

This method has only a single internal caller, inline it for clarity.

Change-Id: I136274b2375b4bb91f35d21dd5d8a206d1272867
Signed-off-by: Robert Varga <>
7 years agoBUG-5280: make sure all DistributedDataStore instances are shut down 29/38929/7
Robert Varga [Mon, 16 May 2016 11:38:09 +0000 (13:38 +0200)]
BUG-5280: make sure all DistributedDataStore instances are shut down

Fix up instantiation sites to eventually close the data store instance
they have created.

Change-Id: Ib71531c0263197209db6ec7de4f6c92d60db3d1d
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: Eliminate ShardIdentifier.Builder 09/38809/15
Robert Varga [Thu, 12 May 2016 14:46:52 +0000 (16:46 +0200)]
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 <>
7 years agoBUG-5280: use MemberName instead of String 02/38802/16
Robert Varga [Thu, 12 May 2016 14:13:08 +0000 (16:13 +0200)]
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 <>
7 years agoBUG-5280: add cds-access-api identifiers 70/38670/16
Robert Varga [Wed, 11 May 2016 14:42:32 +0000 (16:42 +0200)]
BUG-5280: add cds-access-api identifiers

This patch adds a new component, which will hold the API exposed
by the CDS backend and used by the CDS frontend.

Change-Id: If0a2a6372b6cbbe898d2413bcd35259f7900a90a
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: use lambdas, Runnable and Consumer instead of Procedure 10/39010/2
Robert Varga [Tue, 17 May 2016 20:36:55 +0000 (22:36 +0200)]
BUG-5626: use lambdas, Runnable and Consumer instead of Procedure

This eliminates the use of Procedure in SnapshotManager, converting
- Procedure<Void> to java.lang.Runnable
- Procedure<byte[]] to java.util.function.Consumer

Adjust users to use lambdas, making the code more concise.

Change-Id: Iee8ec0f318e3cb38273289431ed8f80377aad912
Signed-off-by: Robert Varga <>
7 years agoDo not override protobuf version 19/38319/5
Robert Varga [Tue, 3 May 2016 11:45:24 +0000 (13:45 +0200)]
Do not override protobuf version

the version is declared in odlparent, no need to specify it again.

Change-Id: If151b2388c881dc6e5fae3ec1e30a6b921badce2
Signed-off-by: Robert Varga <>
7 years agoFix a typo in getDdatastoreContextFactory() 01/38801/3
Robert Varga [Thu, 12 May 2016 10:10:32 +0000 (12:10 +0200)]
Fix a typo in getDdatastoreContextFactory()

Change-Id: Ie4e3154f68afde14530a692a76a59617d4b1836c
Signed-off-by: Robert Varga <>
7 years agoEliminate unneeded String.format() 00/38800/3
Robert Varga [Thu, 12 May 2016 09:44:01 +0000 (11:44 +0200)]
Eliminate unneeded String.format()

Logger already supports formatting strings, no need to pre-format

Change-Id: Iea96443126bad0ca483ec0cc775d081384028497
Signed-off-by: Robert Varga <>
7 years agoRemove AbstractRaftActorBehavior#findClientRequestTracker() 51/38651/5
Robert Varga [Wed, 11 May 2016 08:24:32 +0000 (10:24 +0200)]
Remove AbstractRaftActorBehavior#findClientRequestTracker()

This is an unused method, remove it. Also add some documentation
around trackers and simplify tracker-based messages.

Change-Id: Ia0afca836bd56b75dcdb74d6c6b309a9eeaa75ee
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: use Identifier instead of String 32/38632/7
Robert Varga [Tue, 10 May 2016 12:16:27 +0000 (14:16 +0200)]
BUG-5626: use Identifier instead of String

Using a String for identifying replication entries is not flexible
enough. Yangtools has an Identifier concept and utility classes that
make this more flexible. Use these so we can evolve the identifiers
we use to track requests.

Change-Id: Ie5794d1e929300928c57cbec6d2fe22329fe6a5e
Signed-off-by: Robert Varga <>
7 years agoAdd clustered-app-config blueprint extension example to the toaster 35/38435/5
Tom Pantelis [Wed, 4 May 2016 09:41:23 +0000 (05:41 -0400)]
Add clustered-app-config blueprint extension example to the toaster

Added a toaster-app-config yang to utilize the clustered-app-config
blueprint extension as an example. The operational toaster's
manufacturer and model number were made configurable.

Change-Id: Ie4793ecf49ef42d07c6ca9fbce806533ca49aefd
Signed-off-by: Tom Pantelis <>
7 years agoAdd clustered-app-config blueprint extension 90/38390/7
Tom Pantelis [Wed, 4 May 2016 02:20:06 +0000 (22:20 -0400)]
Add clustered-app-config blueprint extension

Added an extension that obtains a given binding DataObject type from the data
store and provides the DataObject instance to the Blueprint container as a
bean that can be injected into oher beans. In addition it registers a
ClusteredDataTreeChangeListener to restart the Blueprint container when the
data is changed. If no DataObject instance exists, an instance is created
with any defaults values populated. Default data may be specified via
the "default-config" child element which must contain the XML representation
of the yang data, including namespace, wrapped in a CDATA section to prevent
the blueprint container from treating it as markup.

It is assumed the given "binding-class" is a top-level yang container or
list, which seems reasonable. If it's nested then the full path would
have to be specified via XML which is doable but not worth the added
work if not necessary. We'll see if there's a use case for a nested app
config (I doubt it).

A list agg config would be used if there's multiple instances of the
app/module (eg "openflow-switch-connection-provider-impl" in the
openflowplugin). The "list-key-value" must be specified. It is assumed
there's only one list key and that it's a string, ie the yang list is
keyed by the name of app/module.

Change-Id: Ib970b003526d42c2a3db085036174967f055cbba
Signed-off-by: Tom Pantelis <>
7 years agoMake Karaf dump heap on OOM by default 53/38653/2
Vratko Polak [Thu, 7 Apr 2016 14:49:42 +0000 (16:49 +0200)]
Make Karaf dump heap on OOM by default

See mails in this thread:
so if user sets JAVA_OPTS it would override this.

Change-Id: I54fad73c5f50a6bf251bd3b255293ff3ef4ed877
Signed-off-by: Vratko Polak <>
7 years agoBUG-5626: split out CohortEntry 87/38587/3
Robert Varga [Mon, 9 May 2016 15:17:18 +0000 (17:17 +0200)]
BUG-5626: split out CohortEntry

This is a large static class, move it to its own file.

Change-Id: I79c161ec903369b969e649ddb37f96e62a8da829
Signed-off-by: Robert Varga <>
7 years agoFix a generic array warning 22/38322/2
Robert Varga [Tue, 3 May 2016 12:00:39 +0000 (14:00 +0200)]
Fix a generic array warning

ImmutableList.of() has 'fast' methods, which do not devolve to an array,
fixing a warning about generic arrays

Change-Id: Id81a2b185f4128601d047fec579a56c3196d3528
Signed-off-by: Robert Varga <>
7 years agoFix static methods and convert to lambdas 21/38321/2
Robert Varga [Tue, 3 May 2016 12:01:47 +0000 (14:01 +0200)]
Fix static methods and convert to lambdas

This fixes warnings about static methods and as an auto-save action, converts
functional interface implementations to lambdas.

Change-Id: Id4486516282685fb85f9cfc6e512096662475d53
Signed-off-by: Robert Varga <>
7 years agoMake potentially-static methods static 20/38320/2
Robert Varga [Tue, 3 May 2016 11:54:17 +0000 (13:54 +0200)]
Make potentially-static methods static

Change-Id: Ifcb3541dced996f106a3ca4fdf5bfa52130eb6ab
Signed-off-by: Robert Varga <>
7 years agoFix intermittent test failure in ShardTest.testPeerAddressResolved 87/38087/2
Tom Pantelis [Fri, 22 Apr 2016 21:21:54 +0000 (17:21 -0400)]
Fix intermittent test failure in ShardTest.testPeerAddressResolved

This test failed on jenkins with an NPE. The problem is that is called
the Shard's onReceive method directly, which isn't safe, instead of
sending a message. I also changed testApplyState to send a message as

Change-Id: I87c738dc3ecb31f937ec68ab4ca6f60b6d80d93a
Signed-off-by: Tom Pantelis <>
7 years agoFix intermittent failure in LeadershipTransferIntegrationTest 98/38298/2
Tom Pantelis [Tue, 3 May 2016 00:16:32 +0000 (20:16 -0400)]
Fix intermittent failure in LeadershipTransferIntegrationTest

testLeaderTransferAborted failed on jenkins b/c the leader happened to
get an AppenEntriesReply from follower2 for an AppendEntries message
that was sent before the test started dropping AppendEntries messages to
cause leadership transfer to fail and abort. I changed the test so it
drops AppendEntriesReply messages on the leader to avoid this.

Change-Id: I8a04b6dd49a9a46f210658afc33ff6001143b615
Signed-off-by: Tom Pantelis <>
7 years agoChange opendaylight-karaf-distro-archetype to use karaf-parent 92/38092/2
Tom Pantelis [Mon, 25 Apr 2016 23:32:49 +0000 (19:32 -0400)]
Change opendaylight-karaf-distro-archetype to use karaf-parent

Change-Id: I7fd15837db49b4d8201371e06a26d9ce734c4ef7
Signed-off-by: Tom Pantelis <>
7 years agoFix intermittent failures in DistributedDataStoreRemotingIntegrationTest 91/38291/2
Tom Pantelis [Mon, 2 May 2016 18:14:21 +0000 (14:14 -0400)]
Fix intermittent failures in DistributedDataStoreRemotingIntegrationTest

testTransactionRetryWithInitialAskTimeoutExOnCreateTx has failed a couple
times on jenkins. After leader shutdown it times out trying to elect a
new leader. This is b/c the time outs set are small for the test and it
sometimes runs quick enough before member-3 has actually joined the
cluster. So I added calls to wait for members to join the cluster before
running the test.

Change-Id: I4dabaffd3ace9082d46b27d78608df6d2f29734c
Signed-off-by: Tom Pantelis <>
7 years agoFix intermittent failure in ReplicationAndSnapshotsIntegrationTest 42/38242/3
Tom Pantelis [Fri, 29 Apr 2016 08:16:49 +0000 (04:16 -0400)]
Fix intermittent failure in ReplicationAndSnapshotsIntegrationTest

Verification of the follower's snapshot intermittently fails in
testFirstSnapshot. The problem is that the last applied term/index may
or may not reflect the last log index. The test doesn't expect it to and
most of the time it doesn't but it can, which is perfectly fine. So to
avoid intermittent failures I changed it to just verify the snapshot's
last log term/index which shoild be constant.

Change-Id: I8c6d920bea557dcc2ef25b5d37239fdb94a13b8b
Signed-off-by: Tom Pantelis <>
7 years agoBUG-5414 introduce EOS inJeopardy flag 52/36752/8
Robert Varga [Thu, 24 Mar 2016 21:07:49 +0000 (22:07 +0100)]
BUG-5414 introduce EOS inJeopardy flag

The inJeopardy flag is used to indicate that the leader has lost quorum,
e.g. if cannot reach majority of followers or the follower has lost connection
to the leader (and has initiated new elections).

While EOS is in jeopardy, any reported entity state may not reflect cluster-wide
consensus, but rather represents the latest intended state as seen by this node.

Change-Id: I18df5a11ebbef6607fb0a0754ba0f09bc52f19ba
Signed-off-by: Robert Varga <>
7 years agoMove ClusterAdminRpcService to its own bundle 49/36849/18
Tom Pantelis [Tue, 29 Mar 2016 07:41:24 +0000 (03:41 -0400)]
Move ClusterAdminRpcService to its own bundle

The ClusterAdminRpcService can't be instantiated with the clustered
datastore blueprint xml b/c it needs the binding RPC registry service so
I moved it to its own bundle.

I made the ClusterAdminProviderModule a no-op since the
ClusterAdminRpcService is now created via blueprint.

I also had to export some packages from the sal-distributed-datastore

Change-Id: Icaf025517ed9b08a82a81310f1e5dd2ac0647559
Signed-off-by: Tom Pantelis <>
7 years agoBug 1435: CDS: Added support for custom commit cohort. 02/32602/21
Tony Tkacik [Thu, 14 Jan 2016 17:42:33 +0000 (18:42 +0100)]
Bug 1435: CDS: Added support for  custom commit cohort.

Implemented support for user provided commit
cohorts, which implements DOMDataTreeCommitCohort
interface contract.

Messages are only in-JVM so cohort needs to be colocated
with replica.

Change-Id: I04e592c0232383e70fa8944b966b1aa341730a98
Signed-off-by: Tony Tkacik <>
7 years agoAddress comments in prior patches 62/37662/5
Tom Pantelis [Thu, 14 Apr 2016 15:56:01 +0000 (11:56 -0400)]
Address comments in prior patches

Follow-up patch to address comments in and

Change-Id: Ic4e9c4957a3440c8772fe814a3f4732c054b3271
Signed-off-by: Tom Pantelis <>
7 years agoBUG-5280: add a section about actor model 36/37736/4
Robert Varga [Mon, 18 Apr 2016 15:19:38 +0000 (17:19 +0200)]
BUG-5280: add a section about actor model

This reformats the document headlines a bit and adds a section describing
how what the actor parts are in the frontend.

Change-Id: Ib78632ec0d9ac9fa8d72b90c42b5a520a22a1a46
Signed-off-by: Robert Varga <>
7 years agoBug 3011: Changed scope of karaf:standard feature to runtime 42/18542/6
Tony Tkacik [Fri, 17 Apr 2015 13:34:36 +0000 (15:34 +0200)]
Bug 3011: Changed scope of karaf:standard feature to runtime

Compile time scope of karaf standard feature caused
Karaf to install tomcat, jetty and lot of other features
via the

In Karaf 3.0.3 the tomcat feature works fine if installed
via the boot features in the features.cfg but if installed
via, it prevents Karaf from starting.

Also added the eventadmin feature to the startupFeatures so it is
included in the as the bundle does not work
properly for some reason if installed as a boot feature.

Change-Id: I309f7b116976493ba1377b442fb46f5a88f68361
Signed-off-by: Tony Tkacik <>
Signed-off-by: Ryan Goulding <>
7 years agoFix test failures in sal-binding-it 40/38040/1
Tom Pantelis [Fri, 22 Apr 2016 20:31:50 +0000 (16:31 -0400)]
Fix test failures in sal-binding-it

With the recent blueprint patch, the sal-binding-it integration tests
are failing in merge jobs (they don't run on veriy jobs) b/c they don't
install the blueprint bundle. I cobverted them from using the deprecated
TestHelper, which installs bundles, to using AbstractMdsalTestBase which
which installs features.

Also fixed a race condition in BindingToNormalizedNodeCodecFactory founf
when running the tests.

Change-Id: I06bbc33e7dbcb0bff557daccd8e1d87103bebc7d
Signed-off-by: Tom Pantelis <>
7 years agoModify config Module impls to co-exist with blueprint 14/36714/26
Tom Pantelis [Mon, 28 Mar 2016 17:44:11 +0000 (13:44 -0400)]
Modify config Module impls to co-exist with blueprint

Modified various config system Module implementation classes which
have corresponding instances created and advertised via blueprint to
obtain the instance in createInstance from the OSGi registry. The
instance may not be available yet so it will wait. I added a
WaitingServiceTracker class to encapsulate this logic using a ServiceTracker.

For those modules that don't advertise services, createInstance simply
returns a noop AutoCloseable since the components are created via

I also added the new disable-osgi-service-registration flag to the
corresponding service yang identities to prevent the CSS from
duplicating the service registrations.

This patch also adds the blueprint bundle to the mdsal features and
"turns on" blueprint.

Change-Id: I60099c82a2a248fc233ad930c4808d6ab19ea881
Signed-off-by: Tom Pantelis <>
7 years agoBug 2244: Set config subsystem service element namespace 81/37481/3
Andrej Mak [Tue, 12 Apr 2016 08:19:40 +0000 (10:19 +0200)]
Bug 2244: Set config subsystem service element namespace

Change-Id: Ia2dca873d6447c5adb539dee1376718e405727d7
Signed-off-by: Andrej Mak <>
7 years agoBug 5444: Allow null value in config module list setter 33/37433/3
Andrej Mak [Mon, 11 Apr 2016 11:17:54 +0000 (13:17 +0200)]
Bug 5444: Allow null value in config module list setter

Change-Id: Ibdd8f93d7d8bf213892c1af8632f3ec0989cd617
Signed-off-by: Andrej Mak <>
7 years agoEnforce memory percentage 00/37500/3
Robert Varga [Tue, 12 Apr 2016 14:47:49 +0000 (16:47 +0200)]
Enforce memory percentage

Setting a negative percentage does not make sense. Make sure we validate
them in setters.

Change-Id: I4e0eb0a6ea47b3dda897946cc172899996e301f3
Signed-off-by: Robert Varga <>
7 years agoDisable Java 8 linter on projects that fail 32/37232/2
Thanh Ha [Wed, 6 Apr 2016 20:29:27 +0000 (16:29 -0400)]
Disable Java 8 linter on projects that fail

The new Java 8 linter is more strict and causes docs failures on several
projects. Disable it for projects that currently does not pass the

Change-Id: I0d29bad0a797aceeb9076eea8f80bcc071432b4c
Signed-off-by: Thanh Ha <>
7 years agoFix javadoc syntax for filter-valve 31/37231/2
Thanh Ha [Wed, 6 Apr 2016 19:10:03 +0000 (15:10 -0400)]
Fix javadoc syntax for filter-valve

Change-Id: I9a5712a168956d8ac3923a5791ec2de3b0b39123
Signed-off-by: Thanh Ha <>
7 years agoInherit maven-project-info-reports config from odlparent 30/37230/2
Thanh Ha [Wed, 6 Apr 2016 16:05:59 +0000 (12:05 -0400)]
Inherit maven-project-info-reports config from odlparent

Change-Id: Iaea0cd66401cdd86decc5cd64dc5b86afc96446e
Signed-off-by: Thanh Ha <>
7 years agoInherit jdepend-plugin from odlparent 29/37229/2
Thanh Ha [Wed, 30 Mar 2016 20:25:44 +0000 (16:25 -0400)]
Inherit jdepend-plugin from odlparent

odlparent provides this configuration already so just inherit the
upstream configuration.

Change-Id: I55939d991f627d0ced08b6e5a1f429fc4e12f54b
Signed-off-by: Thanh Ha <>
7 years agoDepend on odlparent version of blueprint 86/37286/2
Ryan Goulding [Thu, 7 Apr 2016 18:57:10 +0000 (14:57 -0400)]
Depend on odlparent version of blueprint

Inherit the common version of blueprint core from odlparent.

Change-Id: I98cee88b2c43929cec82a714d6a7530bd1b8064e
Signed-off-by: Ryan Goulding <>
7 years agoBUG-5280: add asciidoc outline of CDS implementation 44/37544/8
Robert Varga [Wed, 13 Apr 2016 13:28:29 +0000 (15:28 +0200)]
BUG-5280: add asciidoc outline of CDS implementation

Adds the basic document outlining requirements place on the data store,
its architecture and basic tradeoffs taken. This is not a final revision,
but rather an initial cut at it. It is expected this document will evolve
further and will remain updated as the design/implementation changes.

Change-Id: I77de9971beaf8303a7ae0e0d1fc0d4d86ae64e5c
Signed-off-by: Robert Varga <>
7 years agoAdd registerToOsgi flag to ServiceInterfaceAnnotation 13/36713/17
Tom Pantelis [Mon, 28 Mar 2016 17:41:36 +0000 (13:41 -0400)]
Add registerToOsgi flag to ServiceInterfaceAnnotation

Added a flag to the ServiceInterfaceAnnotation to allow disabling OSGi
service registration. This is needed for blueprint bundles that have
already registered the service and also need to create the module
and service in the config system for compatibility support.

Change-Id: Ic12d2cdcf6de77ee043a708c76502f8bc36a4717
Signed-off-by: Tom Pantelis <>
7 years agoAdd blueprint wiring for clustering-test-app 70/36570/16
Tom Pantelis [Tue, 22 Mar 2016 04:22:00 +0000 (00:22 -0400)]
Add blueprint wiring for clustering-test-app

Change-Id: Ie644ca52e8fa6d8f07414363e5a70e3ce0bba731
Signed-off-by: Tom Pantelis <>
7 years agoAdd blueprint wiring for netty configs 35/35935/25
Tom Pantelis [Tue, 8 Mar 2016 01:04:28 +0000 (20:04 -0500)]
Add blueprint wiring for netty configs

Wiring for netty-threadgroup-config, netty-timer-config, and

Change-Id: I759b222c6f3fcad1cacbc4aeb1af4cec19faff0d
Signed-off-by: Tom Pantelis <>
7 years agoAdd blueprint wiring to the toaster sample 67/35867/26
Tom Pantelis [Mon, 7 Mar 2016 01:46:38 +0000 (20:46 -0500)]
Add blueprint wiring to the toaster sample

Change-Id: I79922dd24847fd8682a0f2133e6effae9b608a0c
Signed-off-by: Tom Pantelis <>
7 years agoAdd blueprint wiring to sal-binding-broker-impl 53/35853/25
Tom Pantelis [Sun, 6 Mar 2016 07:17:33 +0000 (02:17 -0500)]
Add blueprint wiring to sal-binding-broker-impl

Change-Id: Ie333035f44904e20cc3c23052c2f98e9684c8033
Signed-off-by: Tom Pantelis <>
7 years agoAdd dependency on javax.validation validation-api 55/37555/3
Ryan Goulding [Wed, 13 Apr 2016 15:27:38 +0000 (11:27 -0400)]
Add dependency on javax.validation validation-api

In order to upgrade to org.eclipse.persistence to 2.6.0+ in odlparent,
downstream consumers must include the dependency on javax.validation
validation-api version 1.1.0.Final as described here:

The work to upgrade odlparent's moxy version is included in this patch:

Change-Id: Ia3dc42c498a334d36fefb49fe7ddb936638987b7
Signed-off-by: Ryan Goulding <>
7 years agoRemove unused akka.version property 61/37561/2
Ryan Goulding [Wed, 13 Apr 2016 16:00:06 +0000 (12:00 -0400)]
Remove unused akka.version property

akka dependencies are now derived from odlparent;  remove this unused

Change-Id: I606bcea3cfed9bc1f7a3a824c01e2de0c4185025
Signed-off-by: Ryan Goulding <>
7 years agoUpdate comment so that it is more correct 31/37331/2
Thanh Ha [Fri, 8 Apr 2016 13:44:08 +0000 (09:44 -0400)]
Update comment so that it is more correct

Change-Id: I2a1756be6794e833f1883fcdd8989883bbdc559b
Signed-off-by: Thanh Ha <>
7 years agoUse proper user given values for deploy-site.xml 10/37310/3
Vishal Thapar [Fri, 8 Apr 2016 07:16:57 +0000 (12:46 +0530)]
Use proper user given values for deploy-site.xml

Use user given values for for groupId, version and copyright when
generating deploy-site.xml

Change-Id: I17766e32523710d13a86c7ac70fb4c83b4d72388
Signed-off-by: Vishal Thapar <>
Signed-off-by: Thanh Ha <>
7 years agoAdd blueprint wiring to sal-remoterpc-connector 52/35852/23
Tom Pantelis [Sun, 6 Mar 2016 04:38:19 +0000 (23:38 -0500)]
Add blueprint wiring to sal-remoterpc-connector

Change-Id: I23877888fd49e7dbe4568a7b7a51409589d5ff63
Signed-off-by: Tom Pantelis <>
7 years agoMove null check from getTotalMemory() 95/37495/2
Robert Varga [Tue, 12 Apr 2016 14:16:41 +0000 (16:16 +0200)]
Move null check from getTotalMemory()

This patch converts the interface so it uses a specialized LongSupplier,
which prevents autoboxing. It defines a default retriever, which returns
the memory returned from the JVM, which is used instead of a conditional
method dispatch.

Change-Id: I530baa6512daf3e4e4299783a822e16357723c9a
Signed-off-by: Robert Varga <>
7 years agoCDS: Make AbstractDataBroker non-public 53/36753/7
Robert Varga [Thu, 24 Mar 2016 22:57:03 +0000 (23:57 +0100)]
CDS: Make AbstractDataBroker non-public

Move ConcurrentDataBroker, which is the only subclass into the same package
and make AbstractDataBroker package-protected.

Change-Id: I28fe350bb53a8bfca572c958ba81ca1a74059e14
Signed-off-by: Robert Varga <>
7 years agoDeprecate DCL in favor of DTCL 52/37452/2
Ryan Goulding [Mon, 11 Apr 2016 19:29:35 +0000 (15:29 -0400)]
Deprecate DCL in favor of DTCL

The DataTreeChangeListener abstraction offers many performance and semantic
advantages over DataChangeListener.  Although there is no concrete date for DCL
removal, @Deprecated annotations are added to DCL API and impl classes to
dissuade their use.  An example of how to transition from DCL to DTCL is
included in this patch:

This patch is a follow up from comments made here:

Change-Id: I505bd60ea4642733526c5cfea3850bc0c6ee6798
Signed-off-by: Ryan Goulding <>
7 years agoSimplify ReplicatedLogImpl a bit 90/37490/1
Robert Varga [Tue, 12 Apr 2016 12:33:46 +0000 (14:33 +0200)]
Simplify ReplicatedLogImpl a bit

- move fields and constructor to keep object state together
- eliminate unneeded call to isDebugEnabled() via a getter
- simplify getDataSizeForSnapshotCheck()
- keep ConfigParams in a local variable for more concise code

Change-Id: Ic93c959181148de2e653dbd3f6f6922589c37223
Signed-off-by: Robert Varga <>
7 years agoMake ReplicatedLogImplEntry final 89/37489/1
Robert Varga [Tue, 12 Apr 2016 12:07:36 +0000 (14:07 +0200)]
Make ReplicatedLogImplEntry final

This is a simple DTO, make sure it cannot carry a null payload and
cannot be subclassed.

Change-Id: I6fbe1bfb18b6f1b127b357fc0f40d86cb26a81b7
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: do not allow overriding of RaftActor.handleCommand() 58/36958/18
Robert Varga [Thu, 31 Mar 2016 14:03:46 +0000 (16:03 +0200)]
BUG-5626: do not allow overriding of RaftActor.handleCommand()

Our class hierarchy does not reflect what a typical actor would do
and allows subclasses to override base message processing. This has
the potential to break the RAFT implementation.

Expose a new method, handleNonRaftCommand(), which subclasses can use
to plug in their message processing. This method is invoked after
RAFT message processing has completed.

Change-Id: I8ce2e44db2169e7b1ab55d5f9b6611a187ae1f84
Signed-off-by: Robert Varga <>
7 years agoAdd blueprint wiring to sal-dom-broker 51/35851/23
Tom Pantelis [Sun, 6 Mar 2016 02:49:44 +0000 (21:49 -0500)]
Add blueprint wiring to sal-dom-broker

Change-Id: I48959c4ebf02881dfb29d051b35c45de3effc650
Signed-off-by: Tom Pantelis <>
7 years agoAdd blueprint wiring to sal-distributed-datastore 49/35849/22
Tom Pantelis [Sat, 5 Mar 2016 12:25:59 +0000 (07:25 -0500)]
Add blueprint wiring to sal-distributed-datastore

ALso changed the default in the config yang for shard-election-timeout-factor
as it was changed in the config XML which will no longer be used.

Change-Id: I2439587210c347dc1ac7e3e8ac5e9671fa86cf02
Signed-off-by: Tom Pantelis <>
7 years agoAdd blueprint extension to register notification listener 92/36492/19
Tom Pantelis [Mon, 21 Mar 2016 11:27:36 +0000 (07:27 -0400)]
Add blueprint extension to register notification listener

Added a blueprint extension element <notification-listener> that
registers a NotificationListener implementation with the MD-SAL

Change-Id: I5ba9b1124ccba4d5c0f8d2e323eb3dd0e918cd94
Signed-off-by: Tom Pantelis <>
7 years agoBUG 5690 : No owner present even when entity has a candidate 68/37368/2
Moiz Raja [Fri, 8 Apr 2016 18:09:50 +0000 (11:09 -0700)]
BUG 5690 : No owner present even when entity has a candidate

If a candidate for an entity is removed and another added in quick
succession it can leave the owner of the entity blank. This happens
because the BatchedModifications for candidate removal happen one
after another which results in the commit of those modifications.
The BatchedModification which writes an owner on removal is committed
only after the addition of the new candidate. In this scenario when
the new candidate is added it finds that there is still an owner
for that entity and so it does not assign a new owner for that entity.

To fix this problem in onCandidateAdded we check if the currentOwner
is present in the current candidate list and if it is not then we
choose a new owner.

Change-Id: I47f90314e018e25f2c1dac82342b931c4e2d882d
Signed-off-by: Moiz Raja <>
7 years agoBUG-5626: handle ElectionTimeout message first 33/37033/7
Robert Varga [Sat, 2 Apr 2016 13:19:22 +0000 (15:19 +0200)]
BUG-5626: handle ElectionTimeout message first

ElectionTimeout is a singleton, it is not a RaftRPC, hence its reception leads
to bail from handleMessage(). Move it to the front of the Candidate/Follower methods
so we can simplify the checks performed in those methods.

Change-Id: I3dfef4c42e2997d490de776de1c42e61cfacf217
Signed-off-by: Robert Varga <>
7 years agoBug 3090: An AsyncDataChangeEvent instance's getCreatedData() 43/36443/6
Filip Gregor [Fri, 18 Mar 2016 14:37:19 +0000 (15:37 +0100)]
Bug 3090: An AsyncDataChangeEvent instance's getCreatedData()

added tests

Change-Id: Icfa7d1ef72962cb96929eddcabe51d7b0037f606
Signed-off-by: Filip Gregor <>
7 years agoAdd blueprint extensions to get and register RPC services 85/36485/20
Tom Pantelis [Mon, 21 Mar 2016 08:41:47 +0000 (04:41 -0400)]
Add blueprint extensions to get and register RPC services

Added several blueprint extension elements to support RPCs:

<rpc-implementation> - registers a global RPC implementation. If
"interface" isn't specified, it registers all RpcService interfaces
implemented by the ref'ed instance.

<routed-rpc-implementation> - registers a routed RPC implementation
and returns a RoutedRpcRegistration instance for injection into other
beans via the specified "id. If "interface" isn't specified, it looks
for a single RpcService interface implemented by the ref'ed instance.
If multiple are found it fails since only one RoutedRpcRegistration
instance can be returned.

<rpc-service> - finds the registered RpcService corresponding to the
specified "interface" and makes it available for injection into other
beans via the specified "id".

Internally the bean implementations obtain the binding

Change-Id: I432dfb5378ca8368e41fb5375c9d5515dd3e714d
Signed-off-by: Tom Pantelis <>
7 years agoAdd decorating "type" attr extension for service refs 82/36482/21
Tom Pantelis [Sun, 20 Mar 2016 04:06:08 +0000 (00:06 -0400)]
Add decorating "type" attr extension for service refs

Added an attribute extension to the <service> element that adds an
OSGi service property of the form "type=<value>". This allows providers
of a service to advertise the type of the service to distinguish it from
other services provided for the same interface.

Conversely, the extension can also be used in <reference> elements to allow
consumers of the service to specify which service implementation they

As a convention, the "default" type should be used for the default
implementation of the service with other types being specialized
implementations. This allows consumers to obtain whichever
implementation the provider deems as the default without having to
explicitly know it and allows the provider to switch to a new
implementation without requiring all consumers to change their
referenced type.

If a consumer doesn't specify the "type" attribute, it may be ambiguous
as to which service is obtained. Rather than requiring that the "type"
attribute be specfied for every <reference> element, I added an attribute
extension attribute, "use-default-for-reference-types", to the <blueprint>
element that automatically adds a filter to all <reference> elements where
the "type" property is either not set or set to "default" if the "type"
attribute isn't explicitly specified. This ensures the default implementation
is imported if there are other implementations advertised with other types.

Change-Id: Ie61bb45da1c7539732cd31ab0f8130233c9696fc
Signed-off-by: Tom Pantelis <>
7 years agoAdd restart-dependents-on-update blueprint extension 76/36476/20
Tom Pantelis [Sat, 19 Mar 2016 20:51:29 +0000 (16:51 -0400)]
Add restart-dependents-on-update blueprint extension

Added an attribute extension to the <blueprint> element that adds a bean
processor that scans for any "property-placeholder" elements and reacts to
changes to the corresponding cfg file by restarting this blueprint
container and any dependent containers that consume OSGi services provided by
this container in an atomic and orderly manner. This mimics the module
restart functionality provided by the CSS.

A new OSGi service, BlueprintContainerRestartService, was added that
performs the orderly restart. This service is created and registered by
the BlueprintBundleTracker.

Change-Id: I5f463303c3a8aba35b3ed914268bdc67ac795a5a
Signed-off-by: Tom Pantelis <>
7 years agoAdd Blueprint bundle tracker 48/35848/15
Tom Pantelis [Tue, 5 Apr 2016 04:30:37 +0000 (00:30 -0400)]
Add Blueprint bundle tracker

Added an initial blueprint bundle and BlueprintBundleTracker which
scans ACTIVE bundles for blueprint XML files located under the well-known
org/opendaylight/blueprint/ path and deploys the XML files via the
Aries BlueprintExtenderService. This path differs from the standard
OSGI-INF/blueprint path to allow for controlled deployment of
blueprint containers in an orderly manner.

Change-Id: I21fd5aeb1d9ccd609caa8ea89bd66648fee5ad97
Signed-off-by: Tom Pantelis <>
7 years agoImprove config system shutdown 77/36777/8
Tom Pantelis [Thu, 24 Mar 2016 15:53:39 +0000 (11:53 -0400)]
Improve config system shutdown

On shutdown, the ModuleFactoryBundleTracker is invoked for every removed
bundle which executes the "blank" transaction which in turn calls
ConfigRegistryImpl#beginConfig. This method is synchronized and may block
if a config commit is in progress (which might be waiting on capabilities or
a ModuleFactory). The ModuleFactoryBundleTracker is invoked
synchronously so this can block karaf shut down. It can affect single feature
tests in particular which start and stop karaf quickly.

I'm not exactly sure what the blank tx is for - I think its purpose is to
indirectly cause the deactivated bundle's module(s) to be destroyed. On
shutdown, the ConfigManagerActivator stop method calls ConfigRegistryImpl#close
which destroys all the modules so we really don't need the blank tx to
run on every bundle on shutdown.

On shutdown, karaf first sends a STOPPING event for the system bundle
(id 0). So I added the ConfigManagerActivator as a bundle listener and when
the system bundle 0 transitions to STOPPING, it calls ConfigRegistryImpl#close.
I also added a closed flag in ConfigRegistryImpl which is checked by
beginConfig and commitConfig. In order to make this work right, I had to change
the synchronization in ConfigRegistryImpl, which really was over-synchronized on
"this". I removed synchronized from the beginConfig and close methods to
break the locking between the two and I made ConfigHolder and TransactionsHolder
classes thread-safe by using ConcurrentHashMap which allows close to access them
safely w/o synchronization.  If the closed flag is set, beginConfig
returns a no-op ObjectName, otherwise it calls the synchronized beginConfigSafe
method. In commitConfig, if closed is set or the ON is the no-op ObjectName,
it returns an an empty CommitStatus.

I also changed from synchronizing "this" to using a Lock to take advantage
of the tryLock functionality. As an added measure of safety against
prolonged blocking, if beginConfig is called with the blank tx flag set,
it tries to acquire the lock for 5 sec. If it fails it returns the no-op

After the modules are destroyed by ConfigRegistryImpl#close. the container
will proceed to stop the rest of the bundles and the ModuleFactoryBundleTracker
will initiate blank transactions but they'll be no-ops and won't block.

The ModuleFactoryBundleTracker was also changed to only initiate a blank
transaction for bundles that contain a ModuleFactory (via Boolean state
stored with the BundleTracker).

With these changes, karaf shuts down noticeably faster.

The BlankTransactionServiceTracker also initiates a blank transaction
when services are added and removed. Since these are synchronous calls
we really shouldn't block the OSGi container. So I added a
single-threaded executor to process the blank transactions for the
service changes. The blank transaction on bundle removed has to be done
synchronously as it may still need access to the BundleContext which
becomes invalid after the bundle removed event.

Change-Id: I5482caa4182dcc64df9b6bafefac9b8f2d505d3e
Signed-off-by: Tom Pantelis <>
7 years agoFix ApplyState elapsed time check 84/37084/3
Tom Pantelis [Mon, 4 Apr 2016 05:40:06 +0000 (01:40 -0400)]
Fix ApplyState elapsed time check

On ApplyState, there's a check if the elapsed time exceeds a 50ms
threshold and it logs a warning. However the start time is captured when
the message is created prior to queueing. So if there's many ApplyState
or other messages already queued, the elapsed time also includes the time spent
in the queue, ie as a side effect includes the cumulative processing time
of each prior message in the queue. When a follower starts up, there can
be hundreds to thousands of catchup ApplyState messages and, eventually,
the cumulative processing times can add up to more than 50 ms, in which
case every subsequent ApplyState message trips the threshold with
increasing elapsed times, even though none of them actually took 50 ms
to process. Seeing hundreds to thousands of warnings with misleading
elapsed times looks ominous and leads users to think something is wrong.

Therefore I changed it to capture the start time just prior to calling
applyState so it captures just the processing time for that message. I
also removed the startTime field from ApplyState. This class is
Serializable but it is only ever sent locally to self and is never
serialized so there's no backwards compatibility concerns.

Change-Id: I9493734b5307d6dd5d723e5fe416ba97915dfc63
Signed-off-by: Tom Pantelis <>
7 years agoBUG 5656 : Entity ownership candidates not removed consistently on leadership change 16/37116/3
Moiz Raja [Tue, 5 Apr 2016 01:27:17 +0000 (18:27 -0700)]
BUG 5656 : Entity ownership candidates not removed consistently on leadership change

This patch removes candidates for all downed members when entity ownership shard
leadership changes. This fixes a corner case where a leader/follower are both killed
simulaneously in a cluster which has greater than 3 nodes. In this case the old leader
does not have a chance to remove the killed follower. The new leader does know that
the follower is down so it can remove the candidates for all downed followers on
shard leadership change.

Change-Id: If28f5656e0daee40fb96a937dbd0a868b7d3645a
Signed-off-by: Moiz Raja <>
7 years agoDefault shard-journal-recovery-log-batch-size to 1 21/37121/2
Tom Pantelis [Mon, 4 Apr 2016 14:58:08 +0000 (10:58 -0400)]
Default shard-journal-recovery-log-batch-size to 1

In Helium there was an issue with batching journal log entries in a
single transaction on recovery which could cause validation exceptions
and/or missing data. Setting the batch size to 1 alleviated the issue and
thus it was defaulted to 1.

It was thought this issue wasn't present in Lithium but it is as I have
a Helium journal which exhibits the problem. I have tried this journal
with the current code base and didn't see an issue (it looked like all
data was recovered from what I could tell) but I'm not confident an issue
isn't still lurking with the right combination of modifications across
many journal transactions. It is safest to recover the transactions in the
same manner as they were originally committed, ie one by one.

Therefore I have defaulted the batch size to 1. In my testing, the prior
setting of 1000 doesn't add any value anyway as the recovery time is
virtually the same with batch size 1000 and 1. Setting it to 1
eliminates the potential risk of data loss.

Change-Id: Icd7fd3c60bdd6cf1b677ccae38be810e779d2bd3
Signed-off-by: Tom Pantelis <>
7 years agoBUG-5626: Move leaderId/leaderPayloadVersion fields 24/37024/5
Robert Varga [Fri, 1 Apr 2016 21:36:33 +0000 (23:36 +0200)]
BUG-5626: Move leaderId/leaderPayloadVersion fields

Handling of getLeaderId() depends on behavior:
- for (Isolated)Leader, it is always its local ID
- for Candidate it is always null
- for Follower it can vary
The same is true of leader payload version.

This patch moves these two fields to Follower, makes Candidate return constants and
makes Leader return the values stored in the local context.

Change-Id: I0fca58ab985f14460eef9647a89ede02242e6e7c
Signed-off-by: Robert Varga <>
7 years agoDo not depend on the config generator 87/37087/1
Robert Varga [Mon, 4 Apr 2016 17:03:40 +0000 (19:03 +0200)]
Do not depend on the config generator

This is a bogus dependency, which should not simply exist, as it
causes us to pull in a jar which is not needed at runtime.

Change-Id: I456e420f498cd7e72d94cd65426ec8470149f107
Signed-off-by: Robert Varga <>
7 years agoDeprecate DCL in favor of DTCL 70/36970/2
Ryan Goulding [Thu, 31 Mar 2016 15:02:31 +0000 (11:02 -0400)]
Deprecate DCL in favor of DTCL

The DataTreeChangeListener abstraction offers many performance and semantic
advantages over DataChangeListener.  Although there is no concrete date for DCL
removal, @Deprecated annotations are added to DCL API and impl classes to
dissuade their use.  An example of how to transition from DCL to DTCL is
included in this patch:

Change-Id: Ie6d287224f572f157d41bf56c04b02e60ea8bf2a
Signed-off-by: Ryan Goulding <>
7 years agoBUG-5626: refactor BehaviorStateHolder 20/37020/2
Robert Varga [Fri, 1 Apr 2016 20:08:10 +0000 (22:08 +0200)]
BUG-5626: refactor BehaviorStateHolder

This patch splits this class into two parts: BehaviorStateTracker, which is kept
around for as long as RaftActor lives, and BehaviorState, which is used transiently
when we are about to perform a state change.

This makes it more clear as to what state is required to perform a behavior change
and also prevents us from keeping potentially stale objects around. While it forces
object allocation in message dispatch, BehaviorState objects are extremely short-lived
and do not leak to the help -- hence JVMs should be able to deal with them quickly
during GC or even eliminate allocations based on escape analysis.

Change-Id: Ida23a0dcb75ab6ccd11afcc64742884214760549
Signed-off-by: Robert Varga <>
7 years agoBUG-5626: eliminate SwitchBehaviorSupplier 19/37019/3
Robert Varga [Fri, 1 Apr 2016 18:31:59 +0000 (20:31 +0200)]
BUG-5626: eliminate SwitchBehaviorSupplier

This class acts as an indirection which makes following logic hard, eliminate
it in favor of explicit code.

Change-Id: I8715f6cdaed6e653d39af6741242072b39232022
Signed-off-by: Robert Varga <>
7 years agoReduce test class visibility 13/37013/4
Robert Varga [Fri, 1 Apr 2016 14:37:49 +0000 (16:37 +0200)]
Reduce test class visibility

These classes are not used anywhere else, make that explicit by making them

Change-Id: Ic6549f1b5f6c6df20cc54e4162569363382fe305
Signed-off-by: Robert Varga <>
7 years agoRemove unused TestEntityOwnershipShard 12/37012/4
Robert Varga [Fri, 1 Apr 2016 14:34:22 +0000 (16:34 +0200)]
Remove unused TestEntityOwnershipShard

This class is not used anywhere, remove it.

Change-Id: I3d2aeb4219315681229eda35e749f732bb1f2b73
Signed-off-by: Robert Varga <>