controller.git
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 <rovarga@cisco.com>
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 <rovarga@cisco.com>
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
well.

Change-Id: I87c738dc3ecb31f937ec68ab4ca6f60b6d80d93a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
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 <tpanteli@brocade.com>
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 <tpanteli@brocade.com>
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 <tpanteli@brocade.com>
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 <tpanteli@brocade.com>
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 <rovarga@cisco.com>
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
bundle.

Change-Id: Icaf025517ed9b08a82a81310f1e5dd2ac0647559
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
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 <ttkacik@cisco.com>
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
https://git.opendaylight.org/gerrit/#/c/36476/ and
https://git.opendaylight.org/gerrit/#/c/36485/.

Change-Id: Ic4e9c4957a3440c8772fe814a3f4732c054b3271
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
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 <rovarga@cisco.com>
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 startup.properties.

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

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

Change-Id: I309f7b116976493ba1377b442fb46f5a88f68361
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
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 <tpanteli@brocade.com>
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
blueprint.

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 <tpanteli@brocade.com>
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 <andmak@cisco.com>
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 <andmak@cisco.com>
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 <rovarga@cisco.com>
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
linter.

Change-Id: I0d29bad0a797aceeb9076eea8f80bcc071432b4c
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
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 <thanh.ha@linuxfoundation.org>
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 <thanh.ha@linuxfoundation.org>
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 <thanh.ha@linuxfoundation.org>
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 <ryandgoulding@gmail.com>
8 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 <rovarga@cisco.com>
8 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 <tpanteli@brocade.com>
8 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 <tpanteli@brocade.com>
8 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
netty-event-executor-config.

Change-Id: I759b222c6f3fcad1cacbc4aeb1af4cec19faff0d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 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 <tpanteli@brocade.com>
8 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 <tpanteli@brocade.com>
8 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:

http://stackoverflow.com/questions/28568154/
how-to-get-eclipselink-2-6-0-m3-working-with-jersey-1-18-3

The work to upgrade odlparent's moxy version is included in this patch:
https://git.opendaylight.org/gerrit/#/c/37541/

Change-Id: Ia3dc42c498a334d36fefb49fe7ddb936638987b7
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 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
property.

Change-Id: I606bcea3cfed9bc1f7a3a824c01e2de0c4185025
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 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 <thanh.ha@linuxfoundation.org>
8 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 <vishal.thapar@ericsson.com>
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 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 <tpanteli@brocade.com>
8 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 <rovarga@cisco.com>
8 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 <rovarga@cisco.com>
8 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:

https://git.opendaylight.org/gerrit/#/c/35209/

This patch is a follow up from comments made here:

https://git.opendaylight.org/gerrit/#/c/36970/

Change-Id: I505bd60ea4642733526c5cfea3850bc0c6ee6798
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 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 <rovarga@cisco.com>
8 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 <rovarga@cisco.com>
8 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 <rovarga@cisco.com>
8 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 <tpanteli@brocade.com>
8 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 <tpanteli@brocade.com>
8 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
NotificationService.

Change-Id: I5ba9b1124ccba4d5c0f8d2e323eb3dd0e918cd94
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 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 <moraja@cisco.com>
8 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 <rovarga@cisco.com>
8 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 <fgregor@cisco.com>
8 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
RpcServiceRegistry.

Change-Id: I432dfb5378ca8368e41fb5375c9d5515dd3e714d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 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
want.

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 <tpanteli@brocade.com>
8 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 <tpanteli@brocade.com>
8 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 <tpanteli@brocade.com>
8 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
ObjectName.

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 <tpanteli@brocade.com>
8 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 <tpanteli@brocade.com>
8 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 <moraja@cisco.com>
8 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 <tpanteli@brocade.com>
8 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 <rovarga@cisco.com>
8 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 <rovarga@cisco.com>
8 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:

https://git.opendaylight.org/gerrit/#/c/35209/

Change-Id: Ie6d287224f572f157d41bf56c04b02e60ea8bf2a
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 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 <rovarga@cisco.com>
8 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 <rovarga@cisco.com>
8 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
private.

Change-Id: Ic6549f1b5f6c6df20cc54e4162569363382fe305
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 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 <rovarga@cisco.com>
8 years agoDo not use Strings for internal messages 10/37010/5
Robert Varga [Fri, 1 Apr 2016 14:14:25 +0000 (16:14 +0200)]
Do not use Strings for internal messages

Using a String for the message identity has the effect of the equality
running on Strings, which has the effect that message is not really
isolated, but can be sent by anyone who knows the message content.

Instantiate simple Objects instead, which force a proper identity
equality check. Retain debuggability by having these instances override
toString().

Change-Id: Ia581e0a1e023ace10b5dbb81a44092ca04a4ff8f
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake MessageTracker.Context implement AutoCloseable 08/37008/3
Robert Varga [Fri, 1 Apr 2016 13:16:47 +0000 (15:16 +0200)]
Make MessageTracker.Context implement AutoCloseable

The API contract is indicative of the fact that a Context is really
a resource which needs to be closed. Express this in code and take
advantage of availability of try-with.

Change-Id: I17ebc9e458ad43888fed868a89256cbb0fca7b87
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake config-it-base capable of accepting additional options from derived classes. 23/36923/6
Kevin Wang [Wed, 30 Mar 2016 23:24:00 +0000 (16:24 -0700)]
Make config-it-base capable of accepting additional options from derived classes.

Change-Id: I654224bf9c927e0b393f92036f759b487a8075ad
Signed-off-by: Kevin Wang <kevixw@gmail.com>
8 years agoAdd javanet stax-utils bundle to the odl-mdsal-common feature 76/36976/3
Tom Pantelis [Thu, 31 Mar 2016 18:25:05 +0000 (14:25 -0400)]
Add javanet stax-utils bundle to the odl-mdsal-common feature

Currently the stax-utils artifact is embedded internally by
sal-rest-connector so it isn't generally available. Therefore I added it
to the odl-mdsal-common feature. It is just a regular jar so I used the
wrap scheme to make it into a bundle.

Change-Id: I61909e3e55c0ccc0e3886c73a96db27c6e3664da
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoModify AbstractConfigTestBase to use opendaylight-karaf-empty 76/36776/9
Tom Pantelis [Tue, 29 Mar 2016 13:34:52 +0000 (09:34 -0400)]
Modify AbstractConfigTestBase to use opendaylight-karaf-empty

The vanilla karaf distro that AbstractConfigTestBase installs only has the
base features. We need the standard features which includes eventadmin
which is needed for the upcomng blueprint work. So I changed
AbstractConfigTestBase to install opendaylight-karaf-empty which now
includes the standard features as well as the updated Aries proxy-impl
1.0.5 artifact.

Change-Id: I46100cc8edb9743e0885b156a1adc37e3a18ca9e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoBUG-5626: do not use needless cast 09/36909/2
Robert Varga [Wed, 30 Mar 2016 17:54:45 +0000 (19:54 +0200)]
BUG-5626: do not use needless cast

Casting to Follower is not needed, as we can access the leader ID from
the RaftActorBehavior interface.

Change-Id: Id1b0e20571eb12b14791e7e42abe846ebe3a6b9f
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoInvert equals() invocation for expired TX_COMMIT_TIMEOUT_CHECK_MESSAGE 00/36900/3
Robert Varga [Wed, 30 Mar 2016 15:09:16 +0000 (17:09 +0200)]
Invert equals() invocation for expired TX_COMMIT_TIMEOUT_CHECK_MESSAGE

TX_COMMIT_TIMEOUT_CHECK_MESSAGE is a constant, hence calling equals on it
with the message parameter should be faster than the over way around.

Change-Id: I4d8b8bfa644e7802d90059369266e2227e5c1ca3
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDo not allow RaftActorBehavior.close() to throw Exception 90/36890/3
Robert Varga [Wed, 30 Mar 2016 14:50:55 +0000 (16:50 +0200)]
Do not allow RaftActorBehavior.close() to throw Exception

No implementation uses the ability to throw here, disallow it in API contract.

Change-Id: I8560e60a7cab06f221ff7382f9c205d967efcfe5
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDo not use Stopwatch.toString() in logging 89/36889/3
Robert Varga [Wed, 30 Mar 2016 14:05:29 +0000 (16:05 +0200)]
Do not use Stopwatch.toString() in logging

This prevents a conversion if the log level is not active.

Change-Id: Ia176a61c50929d500a5e041dd59d39c12a445f62
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 5625: Fix OutOfMemoryError in YangStoreSnapshot 86/36886/2
Tom Pantelis [Tue, 29 Mar 2016 17:37:43 +0000 (13:37 -0400)]
Bug 5625: Fix OutOfMemoryError in YangStoreSnapshot

Close the InputStream returned via yangTextSchemaSource.openStream().

Change-Id: I3ecd2e1a3f52f91203a3a00c2f982b061cc62c42
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoUse java.util.Optional in ShardLeaderStateChanged and PrimaryShardInfo 95/36695/4
Robert Varga [Wed, 23 Mar 2016 20:42:04 +0000 (21:42 +0100)]
Use java.util.Optional in ShardLeaderStateChanged and PrimaryShardInfo

This migrates to using Java 8 Optional instead of Guava. It also changes the
constructor conventions as Optional is recommended to be used in short-lived
scenarios (e.g. return type, not argument).

Change-Id: I85db0e02b6c247efd8a84262ee7d05159cf926f8
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse java.util.Objects instead of Guava 82/36682/5
Robert Varga [Wed, 23 Mar 2016 19:41:25 +0000 (20:41 +0100)]
Use java.util.Objects instead of Guava

Java 8 gives us a Objects.equals(), so stop using Guava.

Change-Id: I319d01c3d1d8abeaa2da4a38286e024f3055996b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse java.util.function.Supplier instead of Guava 81/36681/5
Robert Varga [Wed, 23 Mar 2016 19:40:41 +0000 (20:40 +0100)]
Use java.util.function.Supplier instead of Guava

Java 8 gives us a Supplier, so stop using Guava.

Change-Id: I0a7e845727df9ee32d5d77ef51e06b92b4d91bb7
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoSplit out ShardInformation 80/36680/5
Robert Varga [Wed, 23 Mar 2016 19:28:24 +0000 (20:28 +0100)]
Split out ShardInformation

ShardInformation is a large inner class, split it out for easier navigation.

Change-Id: I1748f23ff0902c512251bf4aeeb65451f696ba78
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake ShardManagerInfo a proper view of ShardManager 55/36655/6
Robert Varga [Wed, 23 Mar 2016 15:54:03 +0000 (16:54 +0100)]
Make ShardManagerInfo a proper view of ShardManager

This reduces method visibility, removing unnecessary methods. It also fixes
thread safety issues around local shard lists by repurposing SwitchShardBehavior
and introducing a query message.

Change-Id: I35b05c067448c0be94411e5599e6faee182d2ced
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDo not expose the shutdown initiator in OnComplete 74/36874/3
Robert Varga [Wed, 30 Mar 2016 10:09:02 +0000 (12:09 +0200)]
Do not expose the shutdown initiator in OnComplete

The sender (replyTo) is not used from callbacks or anywhere else, it should
really be just internal to the RaftActor's onShutdown path. Also clarify Shutdown
message.

Change-Id: Ibc64e345e54c101f22ff360afc1d71d9d6a281f7
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUpgrade Aries Proxy 1.0.4 -> 1.0.5 01/36801/3
Stephen Kitt [Tue, 29 Mar 2016 08:14:30 +0000 (10:14 +0200)]
Upgrade Aries Proxy 1.0.4 -> 1.0.5

Karaf 3.0.3 ships with Aries Proxy 1.0.4, but we need the fixes in
version 1.0.5. This patch adds Aries Proxy 1.0.5 to our Karaf
distributions and overrides the version in startup.properties.

Change-Id: Ibe77bc14404e30ea571e46589c983d2e2c47dde5
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoSimplify onShutdown checks 73/36873/1
Robert Varga [Wed, 30 Mar 2016 09:33:48 +0000 (11:33 +0200)]
Simplify onShutdown checks

We check for RaftState.Leader twice in an if/else chain. Check for non-Leader
first and bail early, leaving a simple if/else to handle the leader case.

Change-Id: I26e2821b0e3ab86f1fd50625ddd1a0ad6ae3b3be
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake RaftActor.initiateLeadershipTransfer() private 70/36870/3
Robert Varga [Wed, 30 Mar 2016 09:04:51 +0000 (11:04 +0200)]
Make RaftActor.initiateLeadershipTransfer() private

the only external caller is RaftActorServerConfigurationSupport,
which invokes the method when the actor should become non-voting.

Expose an explicit method for this case and make the leadership
transfer an implementation detail -- making it easier to refactor.

Change-Id: I06c9d1c0c07a92490ddf111d5723c8361001437f
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse inline initialization of Stopwatch 69/36869/3
Robert Varga [Wed, 30 Mar 2016 08:55:53 +0000 (10:55 +0200)]
Use inline initialization of Stopwatch

No need to have it the constructor, just inline the initialization.

Change-Id: Ife07c58baee22a503b1b4b4bbcd4c8fa8bb317dd
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoSimplify isolated leader check 67/36867/3
Robert Varga [Wed, 30 Mar 2016 08:53:08 +0000 (10:53 +0200)]
Simplify isolated leader check

Sonar warns about nested ifs, merge them.

Change-Id: I77fcee90b467bc141b79aa5f8fcccb7f8b4f2fe3
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDo not declare thrown Exception AbstractLeader 66/36866/2
Robert Varga [Wed, 30 Mar 2016 08:50:34 +0000 (10:50 +0200)]
Do not declare thrown Exception AbstractLeader

These methods throw only runtime exceptions, hence tighten the contract
and eliminate a sonar warning.

Change-Id: Ibb8b1f0053f38c5a68cf7e3caaf112c3b7beed09
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse a static YangInstanceIdentifier in AbstractEntityOwnerChangeListener 13/36813/3
Robert Varga [Tue, 29 Mar 2016 12:35:47 +0000 (14:35 +0200)]
Use a static YangInstanceIdentifier in AbstractEntityOwnerChangeListener

This will force reuse of the same YangInstanceIdentifier across instances.

Change-Id: Iec33a79267e059ee7fad694a50f74dc2de87035b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix ShardManagerInfo JMX registration error 94/36794/3
Tom Pantelis [Tue, 29 Mar 2016 12:56:43 +0000 (08:56 -0400)]
Fix ShardManagerInfo JMX registration error

The ShardManagerInfo mbean is failing to register with error:
"ShardManagerInfo does not implement DynamicMBean, and neither
follows the Standard MBean conventions". To be a standard MBean, the
implementation class must be in the same package as the MBean
interface. However recent refactoring moved the ShardManagerInfo
class to a new package so I moved both the ShardManagerMBean class to
the org.opendaylight.controller.cluster.datastore.shardmanager package.

Change-Id: I77870e7cf8274f3e99e116d6f18949ac3cf26e41
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoSplit out AbstractBuilder and rename it 13/36613/6
Robert Varga [Wed, 23 Mar 2016 15:06:13 +0000 (16:06 +0100)]
Split out AbstractBuilder and rename it

This is a DTO-like class, not really a Builder with .build() method. Split it out
of its enclosing class and rename it to AbstractShardManagerCreator.

Change-Id: I891fc685c2d9776384294a708336b32eb34011b5
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRefactor MessageTracker 11/36511/5
Robert Varga [Mon, 21 Mar 2016 19:34:12 +0000 (20:34 +0100)]
Refactor MessageTracker

This patch updates MessageTracker implementation with the following:
- lower overhead when dealing with StopWatch under normal conditions
- prevent Context from being instantiated from the outside
- use a Ticker instance for reliable testing
- use Stopwatch.isRunning() instead of explicit done/enable boolean
- properly reset interval timer when expected message is received
- add explicit @NotThreadSafe and @Beta annotations
- move currentMessage to CurrentMessageContext

Change-Id: Idd553a39a8fb885a5c05e391cb4ae45384a59f07
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMove MessageTracker to sal-clustering-commons 10/36510/5
Robert Varga [Mon, 21 Mar 2016 16:58:54 +0000 (17:58 +0100)]
Move MessageTracker to sal-clustering-commons

Message tracker is useful outside of the data store, move it to commons. This will allow
us to use it in RaftActor's recovery code.

Change-Id: Ia1d8074d6dad7ea051d3650cd417cc773292506c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDrop -XX:MaxPermSize 81/35981/2
Stephen Kitt [Wed, 9 Mar 2016 11:21:48 +0000 (12:21 +0100)]
Drop -XX:MaxPermSize

This is no longer supported in Java 8.

Change-Id: Ic421500c6d6d1432a0fa893799b1155d76eb6502
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoMove SwitchShardBehaviorMessage to shardmanager package 53/36653/4
Robert Varga [Wed, 23 Mar 2016 16:17:59 +0000 (17:17 +0100)]
Move SwitchShardBehaviorMessage to shardmanager package

This message is only used internally by the ShardManager, move it to its
package and limit visibility.

Change-Id: I4c546f214cfcfa2e460cd6e78131e27a6d3bd4d7
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMove ShardManagerSnapshot to new package 98/36598/4
Robert Varga [Wed, 23 Mar 2016 13:27:17 +0000 (14:27 +0100)]
Move ShardManagerSnapshot to new package

This creates a copy of the ShardManagerSnapshot in the new package and uses
readResolve() to perform migration.

Change-Id: I976adbaafd74de64a90d3970e17ce4ea52bdbe40
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoInitialized visitedAddresses to a smaller list 54/36654/4
Robert Varga [Wed, 23 Mar 2016 15:37:04 +0000 (16:37 +0100)]
Initialized visitedAddresses to a smaller list

Adds final keyword to force initialization and provide a hint that
the list will have a single entry.

Change-Id: I8c562faa5ce6f6303ab11717e55b624a31720281
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoAdd **/yang-gen-config/** to checkstyle ignore path 20/36220/3
Thanh Ha [Mon, 14 Mar 2016 21:08:13 +0000 (17:08 -0400)]
Add **/yang-gen-config/** to checkstyle ignore path

Change-Id: I4080cd5a5c6d2ccd9374af9979ff2fca76e607ab
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoAdd yang-jmx-generator dependency 19/36219/3
Thanh Ha [Mon, 14 Mar 2016 20:45:35 +0000 (16:45 -0400)]
Add yang-jmx-generator dependency

When building in parallel sal-dom-xsql fails due to
yang-jmx-generator missing. This implies that yang-jmx-generator is
actually a dependency.

Change-Id: I624d4026d8182c12a147830ded0391eca25b0f62
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoUse range import for odl-akka-* 23/36823/1
Robert Varga [Tue, 29 Mar 2016 16:22:41 +0000 (18:22 +0200)]
Use range import for odl-akka-*

We do not need akka.version, but should use a version range import.

Change-Id: Ib7d2f4233945023fe3b12cdcce01e4a345a35dc8
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoRemove DelegatingRaftActorBehavior 60/36160/11
Robert Varga [Tue, 15 Mar 2016 13:32:58 +0000 (14:32 +0100)]
Remove DelegatingRaftActorBehavior

The delegate is leaked through various methods, implementations of which already have access
to the current behavior if it were available from RaftActorContext. Simplify calling
conventions

Change-Id: I9e27f68e55f28a9afd446abff91fbb38dd26c011
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoEnlarge critical section to cover processNextTransaction() 49/36749/2
Robert Varga [Thu, 24 Mar 2016 18:59:49 +0000 (19:59 +0100)]
Enlarge critical section to cover processNextTransaction()

As it turns out the critical section is not sufficient to cover the case
when the user thread performs a submit/allocate/submit in the time window
between us releasing the in-flight transaction and taking the lock: we would
have to re-check inflightTx after taking the lock.

Since we are going to take the lock anyway, reverse the order of operations
by making processNextTransaction() synchronized, which means the user
thread will not be able to submit the transaction even when it observes
inflightTx as null outside the lock.

Change-Id: I688ceb5e8aae28f5e582b64e6bbaa64c9699c7f5
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMove ShardManager into its own package 90/36590/7
Robert Varga [Wed, 23 Mar 2016 12:29:04 +0000 (13:29 +0100)]
Move ShardManager into its own package

ShardManager contains quite a few classes, which are not used by the rest
of the data store. Some of them are in their own files, some of them are
hosted in ShardManager.java.

This first step allows us to isolate related functionality without leaking
it to the rest of the package, separating internal an external interfaces.

Change-Id: I955296d739d962d912eadf0507c317b0a8e71deb
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoForward pending transactions on leadership change 99/35199/9
Tom Pantelis [Mon, 22 Feb 2016 01:41:16 +0000 (20:41 -0500)]
Forward pending transactions on leadership change

If the current leader is deposed for some reason and it has pending
tx's, on leader change, the tx's will now be converted to
BatchedModifications messages and forwarded to the new leader in the
ready state so the new leader can complete the commits. Previously
they were aborted and failed.

In addition, if there's a current transaction that had already been
canCommitted and possibly preCommitted, CanCommitTransaction and
CommitTransaction messages will also be sent to the new leader appropriately.

Change-Id: I9bbd68856586c15464f4ca0e844f040c6bb5f30a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoImplement change to voting with no leader 23/32723/12
Tom Pantelis [Wed, 13 Jan 2016 21:17:28 +0000 (16:17 -0500)]
Implement change to voting with no leader

Implemented a special case where on a voting state change from
non-voting to voting, if there's no leader, it will try to elect a
leader in order to apply the change and progress.

This is to handle a use case where one has 2 geographically-separated
3-node clusters, one a primary and the other a backup such that if the
primary cluster is lost, the backup can take over. In this scenario,
there's a logical 6-node cluster where the primary sub-cluster is
configured as voting and the backup sub-cluster as non-voting such
that the primary cluster can  make progress without consensus from
the backup cluster while still replicating to the backup. On fail-over
to the backup, a request would be sent to a member of the backup
cluster to flip the voting states, ie make the backup sub-cluster
voting and the lost primary non-voting. However since the primary
majority cluster is lost, there would be no leader to apply, persist and
replicate the server config change.

Therefore, if the server processing the request is currently non-voting
and is to be changed to voting and there is no current leader, it will
try to elect itself the leader by applying the new server config change in
the RaftActorContext and sending an ElectionTimeout. If it's elected
leader, it persists and replicates the new server config. If no leader
change occurs within the election timeout period, it reverts the server
config change and tries to forward the change request to another server
with the same voting state change. In this manner, the intent is to elect
the newly voting server that has the most up to date log.

Change-Id: I67b5b2d3a97745dbe9a8215f9a28f3a840f2a0db
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>