yangtools.git
7 years agoUpdate to akka 2.4.11
Robert Varga [Fri, 7 Oct 2016 16:03:03 +0000 (18:03 +0200)]
Update to akka 2.4.11

Akka has changed declarations, hence we need to deal with
Throwable instanceof of Exception.

Change-Id: If20161ce109a2eb1a839ec3f34b64878eac43932
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoMechanical code cleanup (sal-clustering-commons)
Stephen Kitt [Thu, 22 Sep 2016 15:25:04 +0000 (17:25 +0200)]
Mechanical code cleanup (sal-clustering-commons)

* Remove unnecessary type specifiers (use Java 7 <>)
* Remove unnecessary "extends Object" declarations
* Remove unnecessary semi-colons
* Merge identical catch blocks
* Remove redundant modifiers:
  - enum constructors are private by default
  - interface properties are public static final by default
  - interface methods are public abstract by default
  - interfaces are abstract by default
  - inner interfaces are static by default
  - inner classes in interfaces are public static by default

Change-Id: I37133b6c4737bd33926021056c244789856622c2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoBUG-5280: add ExplicitAsk utility class
Robert Varga [Thu, 25 Aug 2016 09:31:24 +0000 (11:31 +0200)]
BUG-5280: add ExplicitAsk utility class

Akka's support for Explicit Ask with Java functions
is broken and requires a workaround. This patch moves
the previous implementation site to a reusable place
and fixes a caller which was broken.

Change-Id: Idc0fc961b1808c23e01a4ae8c4eafdc93b7974f2
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoChange InstallSnapshot and reply to use Externalizable Proxy
Tom Pantelis [Tue, 26 Jul 2016 22:36:06 +0000 (18:36 -0400)]
Change InstallSnapshot and reply to use Externalizable Proxy

This makes InstallSnapshot cleaner with no public no-arg constructor.

I also removed the InstallSnapshot protobuff message. In addition,
SerializableUtils is no longer needed as there's no more protobuff
messages.

Change-Id: I17aa4f7195cf09b798daee5587bbf50ccbc4bff0
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoEliminate dead letters message when there's no sender
Tom Pantelis [Thu, 23 Jun 2016 18:15:17 +0000 (14:15 -0400)]
Eliminate dead letters message when there's no sender

When sending a message to close a DTCL or DCL registration, if the caller
isn't interested in the reply, it passes ActorRef.noSender() (ie null). Internally
akka translates this to the dead letters actor so you see log messages
of the form "Message [...CloseDataTreeChangeListenerRegistrationReply]
from Actor[...] to Actor[akka://opendaylight-cluster-data/deadLetters] was not
delivered. [1] dead letters encountered.".

To alleviate this we should check if the sender is the dead letters actor
before sending the reply.

Change-Id: Idfaf280acf720cf5727393262638a7783c1af539
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoBug 6106: Prevent flood of quarantine messages
Tom Pantelis [Sat, 25 Jun 2016 02:04:02 +0000 (22:04 -0400)]
Bug 6106: Prevent flood of quarantine messages

Added a "quarantined" flag to the QuarantinedMonitorActor so it only
prints the warning and attempts to restart the karaf container once
(which is invoked indirectly via the caller's Effect callback).

Change-Id: I0a57af729280abded93d1b1a575df1672e52032e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit 3066f54d6d2c6206fa5fabc69a795993c68d2d77)

8 years agoFix serialVersionUID
Robert Varga [Wed, 22 Jun 2016 15:04:53 +0000 (17:04 +0200)]
Fix serialVersionUID

This fixes serialVersionUID not being final. Since it was not final,
as per Serializable contract, it had no effect. To retain compatibility
we must use a generated value.

Also remove use of a deprecated method.

Change-Id: I720dcd2613481eb474072ef29e7190cb0f5a28b6
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-5280: move AbstractDataTreeModificationCursor
Robert Varga [Fri, 3 Jun 2016 12:28:42 +0000 (14:28 +0200)]
BUG-5280: move AbstractDataTreeModificationCursor

AbstractDataTreeModificationCursor functionality is useful for wide
range of users, move it to sal-clustering-commons.

Also eliminate the explicit stack, because YangInstanceIdentifier
already has O(1) methods to maintain a logical stack.

Change-Id: Ia0f8d24f32afd67c059e72cc967949f4c609fd7c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-5280: Remove PeristentMessages
Robert Varga [Thu, 19 May 2016 16:38:28 +0000 (18:38 +0200)]
BUG-5280: Remove PeristentMessages

This class is not used by any live code, remove it along with
the previously-deprecated codepaths.

Change-Id: Iaffc428a15c3cb2822d1465411e84e1d12994e2e
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-5280: remove support for talking to pre-Boron clients
Robert Varga [Thu, 19 May 2016 15:31:22 +0000 (17:31 +0200)]
BUG-5280: remove support for talking to pre-Boron clients

Both transaction chains and transaction identifiers are being changed to
structured data. Unfortunately there is no way to reliably map string
identifiers from versions prior to Boron in a consistent manner.

Pre-Boron messages do not have a concept of a frontend identifier nor its
generation. Implementations are assigning them in a non-deterministic
order and rely on timestamps to disambiguate between generations.

Since Shard-internal state keeping and replication logic will require
these concepts, this patch marks a clean break in compatibility. This
compatibility is only needed in mixed-version clusters, which have not
been validated to work and even if the data store works, it cannot
cope with model mismatches expected from differing versions.

Change-Id: I168fa0a98be10aebd680ce3323c458aad7f15865
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix compilation error
Robert Varga [Mon, 6 Jun 2016 22:13:55 +0000 (00:13 +0200)]
Fix compilation error

SourceIdentifier has lost the public constructor. Use the static
factory method instead.

Change-Id: I634f8b8c9e9f7b92a4edbbad4580fb1bdf179eaf
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoEnsure AbstractUntypedActor#unknownMessage() is called
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 <rovarga@cisco.com>
8 years agoBUG-5626: remove CompositeModification(ByteString)Payload
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 <rovarga@cisco.com>
8 years agoMake potentially-static methods static
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>
8 years agoMove ClusterAdminRpcService to its own bundle
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>
8 years agoModify config Module impls to co-exist with blueprint
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>
8 years agoMake MessageTracker.Context implement AutoCloseable
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 agoRefactor MessageTracker
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
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 agoDo not allow overrides of onReceive{Command,Recover}
Robert Varga [Wed, 16 Mar 2016 13:21:16 +0000 (14:21 +0100)]
Do not allow overrides of onReceive{Command,Recover}

We already have protected methods to handle these cases, do not allow
overrides, as they create confusion around which method does what.

Change-Id: I3d6e9b9c4dc72a53471bf60324e4c7f36845ed5b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 5485: Improve DataTreeModification pruning on recovery
Tom Pantelis [Wed, 9 Mar 2016 04:07:02 +0000 (23:07 -0500)]
Bug 5485: Improve DataTreeModification pruning on recovery

Modified the PruningDataTreeModification and NormalizedNodePruner to
validate path and node QNames via the SchemaContext instead of just
namespaces. This allows migration support for any element to be removed
from a yang hierarchy.

Also handled SchemaValidationFailedException on ready which can happen
with writes which don't immediately validate the sctructure as merge
does. The modification tree is re-applied with pruning.

Change-Id: I8c4f84fbaa93563ce6741d7a3e15855f7fc4940f
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDo not guard simple logging with isXXXEnabled()
Robert Varga [Fri, 11 Mar 2016 12:30:52 +0000 (13:30 +0100)]
Do not guard simple logging with isXXXEnabled()

There is not benefit in the guards, making them pure overhead.

Change-Id: I75e310a2f08e5650db436bb4a7f46d85cbde313d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove commented-out logging
Robert Varga [Fri, 11 Mar 2016 12:07:26 +0000 (13:07 +0100)]
Remove commented-out logging

Remove commented-out logging lines and do not condition simple logging
on isDebugEnabled().

Change-Id: I648ee585a4cf2e4a4dfabecdcf0ce833906b4dac
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 5329: Add factory akka.conf
Tom Pantelis [Fri, 12 Feb 2016 14:08:15 +0000 (09:08 -0500)]
Bug 5329: Add factory akka.conf

Added a factory akka.conf file that is shipped to
configuration/factory/akka.conf. This file contains all the necessary
akka settings. Modified the FileAkkaConfigurationReader to load the
existing configuration/initial/akka.conf file with the factory file as
the fallback. In this manner akka will overlay/merge the initial file
with the factory file. I pared down the initial file to only contain the
settings that users would normally set or configure to setup a cluster,
ie hostname, port, seed-nodes, roles.

In the features.xml, the factory file is configured to always overwrite
so changes are picked up on upgrade. We still preserve the initial file.

Change-Id: I8e80161e21d0ad0e26f1efa1023c670b3a5ef6bc
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove unused org.opendaylight.controller.xml.codec package/classes
Tom Pantelis [Fri, 19 Feb 2016 16:12:17 +0000 (11:12 -0500)]
Remove unused org.opendaylight.controller.xml.codec package/classes

The org.opendaylight.controller.xml.codec utility classes in
sal-clustering-commons are no longer used so remove them. They were
originally used by the remote RPC code for conversion of the legacy
CompositeNode class which has since been removed. The code referencing
CompositeNode et al was removed from these classes but unused
remnants were left behind.

Change-Id: Ic8f880c8075f076549bb822f6dfbaaad81595ed1
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoHide NormalizedNodeOutputStreamWriter
Robert Varga [Wed, 17 Feb 2016 15:17:32 +0000 (16:17 +0100)]
Hide NormalizedNodeOutputStreamWriter

This is an internal implementation class, hide it.

Change-Id: Ib79d5a48dcf967f832b7130b981e5c22a593ef80
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove InputStream constructors
Robert Varga [Wed, 17 Feb 2016 16:30:42 +0000 (17:30 +0100)]
Remove InputStream constructors

These are not used anywhere, remove them and simplify callers.

Change-Id: I1b7f28c8fb73903da2c3ddfe59defba56c44e364
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoNormalizedNodeDataOutput should be AutoCloseable
Robert Varga [Wed, 17 Feb 2016 15:13:09 +0000 (16:13 +0100)]
NormalizedNodeDataOutput should be AutoCloseable

We expect to use autocloseable in implementations, make sure this this
reflected upwards.

Change-Id: Ia7e6b27e514cf04e24b0cdf161510a035846ba12
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove implements NormalizedNodeStreamWriter declaration
Robert Varga [Wed, 17 Feb 2016 15:11:40 +0000 (16:11 +0100)]
Remove implements NormalizedNodeStreamWriter declaration

AbstractNormalizedNodeDataOutput already implements this class, no need
to declare it twice.

Change-Id: I4b217d00fe8054ce777b91b35157443438e65a54
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove NormalizedNodeStreamReader
Robert Varga [Wed, 17 Feb 2016 14:47:20 +0000 (15:47 +0100)]
Remove NormalizedNodeStreamReader

This class has been superseded by NormalizedNodeDataInput, remove it.

Change-Id: I11c915f4aff6ca217e096c42ba1115043a99a3ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix raw type warnings
Robert Varga [Fri, 12 Feb 2016 12:28:25 +0000 (13:28 +0100)]
Fix raw type warnings

Fixes NodeWithValue and similar raw type warnings. Also imports
YangInstanceIdentifier inner interfaces for more readable code.

Change-Id: Iaff9e250fff26b0da70dd9f24d7ccc72121630e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDeprecate InstallSnapshot protobuff messages
Tom Pantelis [Wed, 27 Jan 2016 07:33:32 +0000 (02:33 -0500)]
Deprecate InstallSnapshot protobuff messages

Deprecated the associated InstallSnapshot protobuff message and
changed InstallSnapshot to Externalizable. Backwards compatibility
with pre-boron is maintained. Related code was modified accordingly.

Previously InstallSnapshot took a ByteString. I changed this to byte[]
to avoid the extra copy overhead with ByteString with converting to and
from byte[].

Change-Id: I532d062983e76e63c685e6df1d48e0ae38197a5c
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove deprecated Helium Payload methods
Tom Pantelis [Sun, 24 Jan 2016 05:44:09 +0000 (00:44 -0500)]
Remove deprecated Helium Payload methods

Removed the deprecated encode/decode methods from Payload and its derived
classes.

Change-Id: I52beb2d3991efe9f3a7c2631b8682dc1f324e271
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDeprecate CloseTransactionChain protobuff message
Tom Pantelis [Sat, 23 Jan 2016 05:31:21 +0000 (00:31 -0500)]
Deprecate CloseTransactionChain protobuff message

Deprecate the associated CloseTransactionChain protobuff message and
change the message classes to extend VersionedExternalizableMessage.
Backwards compatibility with pre-boron is maintained. Related code was
modified accordingly.

The CloseTransactionChainReply message isn't used so it was removed.

Change-Id: I58d29eac9cb2f300f92dd4e5cb11484b215ddc48
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove unused protobuff messages
Tom Pantelis [Sat, 23 Jan 2016 05:05:24 +0000 (00:05 -0500)]
Remove unused protobuff messages

Removed the following unused protobuff messages:

   ShardManager.proto
   MockPayload.proto
   KeyValueMessages.proto
   SimpleNormalizedNode.proto

Change-Id: I245068fe7c9ead9ea70d9983e73984067c7655da
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove ListenerRegistration protobuff messages
Tom Pantelis [Sat, 23 Jan 2016 00:08:10 +0000 (19:08 -0500)]
Remove ListenerRegistration protobuff messages

The ListenerRegistration protobuff messages are used to serialize the
corresponding CDS messages but we don't actually send these messages
over the wire so they don't need serialization. So the protobuff
messages were removed. If we do need to serialize these messages in he
future we won't use protobuff.

Change-Id: I3818a965e0fd4e1876364022f2de09b1bac216d5
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove DataChangeListener protobuff messages
Tom Pantelis [Fri, 22 Jan 2016 23:36:56 +0000 (18:36 -0500)]
Remove DataChangeListener protobuff messages

The DataChangeListener protobuff messages are used to serialize the
corresponding CDS messages but we don't actually send these messages over
the wire so they don't need serialization. So the protobuff messages were
removed. If we do need to serialize these messages in the future we won't
use protobuff.

Change-Id: Ia72f3da2edbc6c1eeebfb022916894e2b1713840
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDeprecate 3PC protobuff messages
Tom Pantelis [Fri, 22 Jan 2016 11:34:19 +0000 (06:34 -0500)]
Deprecate 3PC protobuff messages

Deprecated the associated protobuff messages for

  CanCommitTransaction[Reply]
  CommitTransaction[Reply]
  AbortCommitTransaction[Reply]

The message classes now extend VersionedExternalizableMessage. Related
code was modified accordingly.

The PreCommitTransaction message is no longer used so it was removed.

Backwards compatibility with pre-boron will be implemented in the next
patch as ThreePhaseCommitCohortProxy needs some refactoring so the
appropriate cohort version can be used for the messages.

Change-Id: I8164ec82c7ef1623d38b1599af2f1c73fadb5300
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoBug 5109: Handle stand alone leaf nodes in CDS streaming
Tom Pantelis [Thu, 21 Jan 2016 15:59:50 +0000 (10:59 -0500)]
Bug 5109: Handle stand alone leaf nodes in CDS streaming

Modified AbstractNormalizedNodeDataOutput to output the leaf set QName
that is now passed to leafSetEntryNode if no parent LeafSetNode QName is
present. Modified NormalizedNodeInputStreamReader accordingly.

I also found that OrderedLeafSetNode was not handled correctly.
AbstractNormalizedNodeDataOutput#startOrderedLeafSet needs to set
lastLeafSetQName.

The NormalizedNodePruner assumed a leaf set entry node must have a
parent and threw an exception if not, similarly with leaf node and anyXML
node. But all 3 can be standalone so I modified NormalizedNodePruner to
handle it.

Change-Id: I02a71d9280dac0eb466ff401699a40d3d8826220
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove Helium ReadDataReply protobuff message
Tom Pantelis [Wed, 20 Jan 2016 04:02:55 +0000 (23:02 -0500)]
Remove Helium ReadDataReply protobuff message

The ReadDataReply protobuff message was kept for backwards compatibility
with Helium so remove it.

Change-Id: I3a30f113903f6d908bea698c0bb9bc773046237e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDeprecate CloseTransaction protobuff message
Tom Pantelis [Wed, 20 Jan 2016 06:19:18 +0000 (01:19 -0500)]
Deprecate CloseTransaction protobuff message

Deprecated the associated CloseTransaction and CloseTransactionReply
protobuff messages and changed the message classes to extend
VersionedExternalizableMessage. Backwards compatibility with pre-boron
is maintained. Related code was modified accordingly.

While the backend sends back the CloseTransactionReply, the transaction
front-end doesn't actually use it so I removed the protobuff-related
code in CloseTransactionReply as it doesn't matter which serialized
version is returned.

Change-Id: I42946bbb38c5ff84d05ee0578d8ca9c8f124d5ed
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove Helium Tx modify operation messages
Tom Pantelis [Tue, 19 Jan 2016 23:18:19 +0000 (18:18 -0500)]
Remove Helium Tx modify operation messages

Removed the following deprecated Helium Tx messages and related code:

  DeleteData[Reply]
  MergeData[Reply]
  WriteData[Reply]
  ReadyTransaction

Also removed the associated protobuf message classes.

Change-Id: I6f5db0096a60b50e51bf94b12f38941a4be9ca20
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoReduce logging in QuarantinedMonitorActor
Tom Pantelis [Wed, 20 Jan 2016 19:01:41 +0000 (14:01 -0500)]
Reduce logging in QuarantinedMonitorActor

The QuarantinedMonitorActor logs every AssociationErrorEvent as warn
which causes a lot of output when a peer node is down as akka raises a
conneciton-refused event every 5 sec until it re-connects. Since we're
only interested in the specific quarantined event, which is logged at
warn, other events should log to debug to avoid the noise.

Change-Id: I26ab7db9a71d137ae3227409d6dcbf39675c6ec9
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoBug 2062 - StreamWriter APIs loses information about leaf-set ordering
Robert Varga [Mon, 10 Nov 2014 15:16:57 +0000 (16:16 +0100)]
Bug 2062 - StreamWriter APIs loses information about leaf-set ordering

* modified clustering NormalizedNodeStreamWriter implementation to use
OrderedLeafSet

Change-Id: I663f6b6d894b8366b7a54a3c56be05f20fef43c2
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4626: create AbstractNormalizedNodeDataOutput
Robert Varga [Tue, 8 Dec 2015 13:02:50 +0000 (14:02 +0100)]
BUG-4626: create AbstractNormalizedNodeDataOutput

Create an internal NormalizedNodeDataOutput implementation for reuse of
code between stream versions.

Change-Id: I60e68fe150ba49d37a6821b057b9ef93a8e600e5
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4626: Introduce NormalizedNodeData{Input,Output}
Robert Varga [Sun, 6 Dec 2015 22:07:36 +0000 (23:07 +0100)]
BUG-4626: Introduce NormalizedNodeData{Input,Output}

Introduce the interfaces that are actually consumed, so that the
external interface is accurately captured.

Change-Id: I8ba93c279cfb4de063afb9c1078e97080e735e44
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4626: Split out stream token types
Robert Varga [Thu, 26 Nov 2015 11:46:59 +0000 (12:46 +0100)]
BUG-4626: Split out stream token types

Move token types and version into a dedicated internal class, adding
some documentation and introducing planned token types.

Also adds validation of stream version on reception, so that parsing
fails predictably in case of sender doing the worng thing and sending us
an unrecognized version.

Change-Id: I85fd9615b897e0fe4addb7f1807416d7bfe1b903
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3874: Support of yang modeled AnyXML
Peter Kajsa [Wed, 11 Nov 2015 13:53:34 +0000 (14:53 +0100)]
Bug 3874: Support of yang modeled AnyXML

Controller changes due to anyXml support in Yangtools.

Notice: Yangtools patch and Controller patch should be merged at once.

Change-Id: I4ff9ef4a0e03f6ad9b30c2a35b97b3a6fa1793d9
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoClean NormalizedNodeSerializer up
Robert Varga [Mon, 30 Nov 2015 23:27:22 +0000 (00:27 +0100)]
Clean NormalizedNodeSerializer up

The map holding deserializer functions should be an immutable constant.
Create a temporary EnumMap and then wrap it via an immutable facade.
Also make the function defitions denser.

Change-Id: I9adc4151c222ca32902ccd59902cbea1c9100b74
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoDeprecate NormalizedNodeInputStreamReader(InputStream)
Robert Varga [Fri, 27 Nov 2015 16:48:23 +0000 (17:48 +0100)]
Deprecate NormalizedNodeInputStreamReader(InputStream)

Using ByteStreams.newDataInput() allows us to deprecated ineffcient
constructor, keeping the API cleaner.

Change-Id: Ia8fa4114ce82ccb440f859584069a8c6d6a397ea
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRename packages
Jakub Morvay [Thu, 3 Dec 2015 09:47:47 +0000 (10:47 +0100)]
Rename packages

Rename package org.opendaylight.controller.cluster.schema.repository ->
org.opendaylight.controller.cluster.schema.provider and also package
org.opendaylight.controller.cluster.schema.repository.impl ->
org.opendaylight.controller.cluster.schema.provider.impl.

Also rename RemoteYangTextSourceImpl -> RemoteYangTextSourceProviderImpl.

Change-Id: Ibb3eb34a7669f7568996fcd4109ae672816a2235
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
8 years agoRemote yang text source provider implementation
Jakub Morvay [Mon, 2 Nov 2015 08:00:20 +0000 (09:00 +0100)]
Remote yang text source provider implementation

Change-Id: Ie2495b1561ff95508b9a31ffa0aad79ddb59a8c5
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
8 years agoAutomatic addition of final keywords
Robert Varga [Thu, 26 Nov 2015 11:44:11 +0000 (12:44 +0100)]
Automatic addition of final keywords

Mostly method arguments, prior to making any other change.

Change-Id: Ie25e0284fea0acf004fe43e4f0ac6f67843be25c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG 4589 : Handle writing and reading large strings
Moiz Raja [Tue, 10 Nov 2015 01:56:32 +0000 (17:56 -0800)]
BUG 4589 : Handle writing and reading large strings

Change-Id: If81926757aef3c1275ba43a7cf8c7adf94d86e08
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit 28484d59aa626dd4b32cdeb2d10dbc2c47cc051a)

8 years agoAlways persist ServerConfigurationPayload log entries
Tom Pantelis [Thu, 29 Oct 2015 14:27:28 +0000 (10:27 -0400)]
Always persist ServerConfigurationPayload log entries

We need to always persist ServerConfigurationPayload log entries
regardless of whether or not persistence is enabled for the derived
RaftActor's data.

I added a new tagging interface PersistentPayload, implemented by
ServerConfigurationPayload, to indicate a Payload
needs to always be persisted. Since log entries are persisted by
both the RaftActor and Follower behavior via the ReplicatedLog, the
logic to determine persistence based on PersistentPayload needs to be
available to both. The ReplicatedLog uses the persistence provider
contained in the RaftActorContext which is the
DelegatingPersistentDataProvider set by the RaftActor. So to keep
the rest of the code the same and keep it simple, I derived a
RaftActorDelegatingPersistentDataProvider which overrides persist to
handle the PersistentPayload logic utilizing the RaftActor's
existing PersistentDataProvider.

Change-Id: I243026b28ed57461ad92324b6947091ae74a7127
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoMake private methods static
Robert Varga [Fri, 23 Oct 2015 10:34:58 +0000 (12:34 +0200)]
Make private methods static

These methods do not reference object state and therefore can be made
static.

Change-Id: I416e415b90647b4f700b7893fe4f64f479271fab
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 4037: Allow auto-downed node to rejoin cluster
Gary Wu [Fri, 2 Oct 2015 20:12:43 +0000 (13:12 -0700)]
Bug 4037: Allow auto-downed node to rejoin cluster

This patch will detect when a node has been
auto-downed/quarantined by another node. When this
happens, the ActorSystem of the datastore will be
restarted to allow the node to rejoin the cluster.

Change-Id: I0913bf455d426b6a0fccb17eac61b74f0911fa5d
Signed-off-by: Gary Wu <Gary.Wu1@huawei.com>
8 years agoBUG 4151 : Create a shared actor system
Moiz Raja [Tue, 29 Sep 2015 03:26:38 +0000 (20:26 -0700)]
BUG 4151 : Create a shared actor system

This patch adds an ActorSystemProvider interface in clustering commons
with a method to get a shard ActorSystem instance which uses the
clustered data store configuration as it contains more configuration
options than the rpc connector which pretty much uses stock configuration.
I added a config yang to define an actor-system-provider-service.

I added the ActorSystemProvider implementation and actor-system-provider-impl
config yang in the distributed datastore bundle. I tried it in
sal-clustering-commmons originally but ran into akka errors re: missing
config properties and it also couldn't find the
ReadyLocalTransactionSerializer class. So to avoid chasing down those
errors I put the implementation in sal-distributed-datastore. I think
this makes sense as it is the prime user of the actor system.

I added a dependency for the ActorSystemProvider service in both
datastores modules so the ActorSystem is now injected in and passed
to the DistributedDataStoreFactory. The dependency was also added to the
RPC mpdule.

Elements for the new actor system provider service and impl were added to
the 05-clustering.xml file along with the wiring changes for the data
stores and RPC modules.

Change-Id: I79c14f84c992a2d5ac9c1f1856efbaeba3cc2b77
Signed-off-by: Moiz Raja <moraja@cisco.com>
8 years agoEnabling Data Change Notifications for all nodes in cluster.
Harman Singh [Fri, 24 Jul 2015 01:32:46 +0000 (18:32 -0700)]
Enabling Data Change Notifications for all nodes in cluster.

Two new interfaces are introduced ClusteredDataChangeListener and ClusteredDOMDataChangeListener and external applications will have to implement any of that interface,
if those applications want to listen to remote data change notifications.

Datastore registers listeners, which are instance of that interface, even on followers.

Change-Id: I0e29cdf2a08a2051de5fc8ce73b9ec8ac408e45b
Signed-off-by: Harman Singh <harmasin@cisco.com>
8 years agoRemoving the redundant configuration reader in the distributed datastore.
kalaiselvik [Tue, 11 Aug 2015 06:46:16 +0000 (12:16 +0530)]
Removing the redundant configuration reader in the distributed datastore.
Having a common configuration reader in the clustering common for use
by both distributed datastore and remote rpc.

Change-Id: Id40295301d76dad40189fb45ffc2917260ba2925
Signed-off-by: kalaiselvik <Kalaiselvi_K@Dell.com>
8 years agoFix license header violations in sal-clustering-commons
Thanh Ha [Sun, 9 Aug 2015 01:26:24 +0000 (21:26 -0400)]
Fix license header violations in sal-clustering-commons

Change-Id: I1b76464cd875fdaaedeebc22cf35cae11714990d
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
9 years agoBUG 2970 : Recovery fails with SchemaValidationException when removing modules
Moiz Raja [Fri, 12 Jun 2015 01:29:07 +0000 (18:29 -0700)]
BUG 2970 : Recovery fails with SchemaValidationException when removing modules

My prior fixes for bug 2970 did not address the recovery problem when a module is
removed but it's data is still present in the persisted files. This patch attempts
to address that.

There seems to be no schema validation when you write a normalized node at / so
for when writing or merging at / the pruning is done first before attempting a
write on InMemoryDataTreeModification

Also removed all unneccessary code.

Change-Id: Id2793330441606c62dfd903cdd698c2f86b14c1b
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit 9a06d5de97157fdd497946f7c467c928344e0e67)

9 years agoTake advantage of YangInstanceIdentifier methods
Robert Varga [Fri, 22 May 2015 16:14:47 +0000 (18:14 +0200)]
Take advantage of YangInstanceIdentifier methods

YangInstanceIdentifier provides new, fast methods to acquire parent,
check if it empty and size of path arguments. Take advantage of them.

Change-Id: I527ff8cefb2799cb188ffe294c69e3b81a0d6909
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit ad7a6537b709a72e763835cae683b8cc12401ce1)

9 years agoBug 3020: Add leader version to LeaderStateChanged
Tom Pantelis [Fri, 24 Apr 2015 22:26:22 +0000 (18:26 -0400)]
Bug 3020: Add leader version to LeaderStateChanged

Added the leader's payload version to the LeaderStateChanged message and
modified the raft code to set it.

Change-Id: I9a34f90641a2962418d234bb56e55f2df5207e5b
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit 13ba9adfa24716a7b27bc4cfef198b3fa5c577b0)

9 years agoBUG 2970 : Create a PruningDataTreeModification
Moiz Raja [Sat, 23 May 2015 00:22:02 +0000 (17:22 -0700)]
BUG 2970 : Create a PruningDataTreeModification

The PruningDataTreeModification automatically tries to prune the passed
in NormalizedNode if an IllegalArgumentException is thrown when doing
a write or a merge on the DataTreeModification.

*I know* that doing the pruning on IllegalArgumentException is flaky but
that is the best I can do unless we can change the implementation in yangtools
to throw a more specific exception when the data node does not map to a
the schema context

Change-Id: Iea0cea82eda8bd51c1f3f07b063404458798c348
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit 759e3c83955458b56d5d3e5a64521e0662b41004)

9 years agoBUG 2970 : Create a utility class which can prune a normalized node based on the...
Moiz Raja [Fri, 22 May 2015 11:03:00 +0000 (04:03 -0700)]
BUG 2970 : Create a utility class which can prune a normalized node based on the schema context

This will be used when a data modification operation fails because of a missing schema
failure.

Change-Id: I6e07763051cc2181c0c786a0762cbf6a3c5c4eed
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit 9055581e2aabac7478102c6b05f9118b443a9d64)

9 years agoFix CDS serialization failures due to YangInstanceIdentifier change
Tom Pantelis [Sat, 16 May 2015 19:13:41 +0000 (15:13 -0400)]
Fix CDS serialization failures due to YangInstanceIdentifier change

YangInstanceIdentifier was recently made an abstract class with 2
implementations which broke CDS serialization as it was looking for
an exact match for the YangInstanceIdentifier class.

Change-Id: Iba94dda9584f65f5c8d76a1514d3f9f09d2f0483
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit bc42ccb9b9bef46de08370e9d958e0e2fe3dda5a)

9 years agoBug 3258 : Changed the order of condition for OrderedMap and MapNode,
Harman Singh [Mon, 18 May 2015 18:10:23 +0000 (11:10 -0700)]
Bug 3258 : Changed the order of condition for OrderedMap and MapNode,
same for OrderedLeafSet and LeafSet
Added a test to validate it works for OrderedMap

Change-Id: Ifb0375d47668fcc36d824fb33a8b4684e89dccc8
Signed-off-by: Harman Singh <harmasin@cisco.com>
9 years agoReturn local shard tree from FindPrimaryShard
Tom Pantelis [Tue, 21 Apr 2015 20:09:20 +0000 (16:09 -0400)]
Return local shard tree from FindPrimaryShard

Added a new ShardLeaderStateChanged message that includes the Shard's
DataTree as an Optional. If the shard is the leader, it returns it's
local DataTree, oherwise returns absent.

The ShardManager now returns a LocalPrimaryShardFound response to
FindPrimary if the shard's DataTree is present. Otherwise it returns
RemotePrimaryShardFound (renamed from PrimaryFound).

Change-Id: I4413aacfff3d3d2ee89df7c4a3a1d7f7c3d2c486
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit fdddb482b07c3ee2f3ca853d09ee9a6ecdd7eb2a)

9 years agoClustering: Expose PathArgument writer
Robert Varga [Sun, 19 Apr 2015 01:03:10 +0000 (03:03 +0200)]
Clustering: Expose PathArgument writer

In our upcoming clustering work we will be serializing
DataTreeCandidate, which is a PathArgument-indexed tree structure.
Expose PathArgument writer and read methods for later use. Also fix
NormalizedNodeOutputStreamWriter not calling flush() on close().

Change-Id: Ided34a8bc1bc77b5ef357346e3d5b057bffc40c1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSimplify instantiation of NormalizedNodeInputStreamReader
Robert Varga [Tue, 21 Apr 2015 11:35:19 +0000 (13:35 +0200)]
Simplify instantiation of NormalizedNodeInputStreamReader

Constructor which takes a DataInput does not need to throw, so remove
that declaration. That makes it easier for users to instantiate it.

Change-Id: Ia9267c6610fe2ebbfa2cb24a4475bba5c486f6df
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2948: Add getLastSequenceNumber method to DataPersistenceProvider
Tom Pantelis [Sat, 4 Apr 2015 02:01:40 +0000 (22:01 -0400)]
Bug 2948: Add getLastSequenceNumber method to DataPersistenceProvider

New method that returns the last sequence number from akka's persisted
journal. This will be used in a subsequent patch.

Change-Id: Ie2b77358c57eb3e30fea7af317f277d7e660125e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
9 years agoAdd generic arguments
Robert Varga [Fri, 27 Mar 2015 17:31:02 +0000 (18:31 +0100)]
Add generic arguments

This patch silences a few eclipse warnings about use of generic types
without proper arguments.

Change-Id: Ia260593e7b5b5fa4cb49894752a286c47aa7c049
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-2673: make CDS implement DOMDataTreeChangeListener
Robert Varga [Tue, 17 Mar 2015 10:18:53 +0000 (11:18 +0100)]
BUG-2673: make CDS implement DOMDataTreeChangeListener

This patch adds the base support for registering
DOMDataTreeChangeListeners. These are delivered only on the local node,
as efficient serialization requires interaction with the cluster
topology and shard leadership handoff. That functionality will be
delivered in a follow-up patch.

It also introduces a bit common infrastructure to be used by
DataChangeListener code, as it performs a very similar function.

Change-Id: Ifb91d08857684fb160fd923bc25c294d2fca4bc3
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Adjust Tx rate limiter for unused transactions"
Moiz Raja [Mon, 30 Mar 2015 23:13:25 +0000 (23:13 +0000)]
Merge "Adjust Tx rate limiter for unused transactions"

9 years agoAdjust Tx rate limiter for unused transactions
Tom Pantelis [Wed, 25 Mar 2015 19:25:48 +0000 (15:25 -0400)]
Adjust Tx rate limiter for unused transactions

I have a test that submits an arbitrary number of config transactions
and I noticed it can take an unusually long time depending on the
initial Tx rate limit setting. With the default setting of 100 it was
very slow even though I could see the adjusted limit increasing where
the elapsed time should've been much shorter.

It turns out the config datastore rate limit wasn't issue. When a
front-end Tx is created, a Tx instance is created in each data store.
The operation Tx's were unused but they artificially limited the config
rate since the operational rate wasn't getting updated, ie it stayed at
100.

I made changes to adjust the rate limit for unused Tx's if there have
been no prior "real" Tx's for that data store. In this case, the
percentile metrics will be 0 so I basically adjust to the current rate
from the other data store. I think this makes sense if we have no other
data to go by.

This required some infa changes so the ActorContext could get access to
the metrics timer for the other data store. Mainly, we need a global
MericsRegistry and JmxReporter across both data stores. I reused the
MetricsReporter class for this to get the static instance (with changes to
support multiple MetricsReporters per domain name). I also added
a static method to get all the data store names.

I found it useful to see the current rate limit via JMX so I added a new
DatastoreInfoMXBean to report it.

Change-Id: I09def94e40a1fe57779e76763e48696140f3a125
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
9 years agoRefactor DataPersistenceProviders and RaftActor#persistence
Tom Pantelis [Thu, 26 Mar 2015 02:22:45 +0000 (22:22 -0400)]
Refactor DataPersistenceProviders and RaftActor#persistence

Refactored protected DataPersistenceProvider inner class impls to new
files for reuse in unit tests and to reduce inner code.

Also modified RaftActor so the DataPersistenceProvider is set rather
than having derived classes provide via the persistence() abstract method.
This makes it a little easier for derived RaftActors in that they don't
have to maintain a field and easier for unit tests to change the
DataPersistenceProvider impl.

Added a DelegatingPersistentDataProvider that holds the actual impl for
RaftActor. This allows the DataPersistenceProvider to be passed to
internal helper classes without having to update them if the underlyting
impl is changed.

These changes will facilitate further refactoring of code in RaftActor
into separate classes to simplify it.

Change-Id: I520b0d83635356f195e6bff33e44ac8f49e793cf
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
9 years agoBUG 2773 : Transition Shard to Leader state when it has no peers
Moiz Raja [Fri, 20 Mar 2015 05:21:09 +0000 (22:21 -0700)]
BUG 2773 : Transition Shard to Leader state when it has no peers

This patch attempts to still take a Shard through it's normal state transitions
so that we still get the term incrementing and other stuff which is specific
to Raft to happen.

Change-Id: Ic786b5440a258eda7ec311300bffeac2ab49e6c2
Signed-off-by: Moiz Raja <moraja@cisco.com>
9 years agoAdd LeaderStateChanged notification
Tom Pantelis [Tue, 24 Mar 2015 17:55:27 +0000 (13:55 -0400)]
Add LeaderStateChanged notification

For upcoming work, the ShardManager will need to know a shard's
leaderId and, eventually, version. In the RaftActor, when the
behavior's leaderId changes, it now sends a LeaderStateChanged message
to the RoleChangedNotifier actor. The ShardManager will listen for
LeaderStateChanged messages (in another patch).

Change-Id: I53e2d7cae8fd19f96650546af395f82189a09fd8
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
9 years agoBUG 2412 - remove CompositeNode from sal-clustering-common
Jan Hajnar [Wed, 18 Mar 2015 14:25:15 +0000 (15:25 +0100)]
BUG 2412 - remove CompositeNode from sal-clustering-common

* cleaning all help methods from Util classes which are working
with deprecated CompositeNode class

Change-Id: I31397a1379ef541d642acec68542860ac689481e
Signed-off-by: Vaclav Demcak <vdemcak@cisco.com>
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
9 years agoBUG-1513: migrate users to ChoiceSchemaNode
Robert Varga [Wed, 11 Mar 2015 09:59:11 +0000 (10:59 +0100)]
BUG-1513: migrate users to ChoiceSchemaNode

This migrates all users to the new interface name, cleaning them up as
the data.api and model.api name clash is resolved.

Change-Id: Ibdc317d5ff86c6a895cccdacf6dfea1fb005d9b6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMigrate users of AnyXml node to DOMSource
Maros Marsalek [Fri, 6 Mar 2015 13:37:57 +0000 (14:37 +0100)]
Migrate users of AnyXml node to DOMSource

AnyXml node used to wrap Node<?> but now wraps a DOMSource

Change-Id: If4f5845e5a0611d5fe38951dd6afe73d0a6f95bc
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoRaft behavior logging
tpantelis [Tue, 10 Feb 2015 06:07:28 +0000 (01:07 -0500)]
Raft behavior logging

Added more logging in the raft behavior classes where appropriate.

Reduced logging in some places to trace or removed redundant logging to
avoid too much output when debug level is enabled.

Removed isDebugEnabled() checks in various places where not needed to
improve test line coverage.

Also I found it useful to see the behavior's state in the log messages.
So I added a logName field and method to AbstractRaftBehavior that
is printed in each log message instead of just context.getId().

Also added/modified toString() in a few RaftRPC message classes.

Change-Id: Ic4d3c93e25d5caf16319b8433d54cab69b26f5c0
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoBug 2669: Use slf4j Logger instead of akka LoggingAdapter
tpantelis [Sun, 1 Feb 2015 21:52:59 +0000 (16:52 -0500)]
Bug 2669: Use slf4j Logger instead of akka LoggingAdapter

Change-Id: I8ca8d4979448cb158f6fb2dd89124a3b4e6e39e8
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoMerge "Add signature marker and version to NormalizedNode streaming"
Moiz Raja [Tue, 10 Feb 2015 01:43:11 +0000 (01:43 +0000)]
Merge "Add signature marker and version to NormalizedNode streaming"

9 years agoBug-2590: Clustering : Minimize usage of in-memory journal
Kamal Rameshan [Thu, 29 Jan 2015 19:44:30 +0000 (11:44 -0800)]
Bug-2590: Clustering : Minimize usage of in-memory journal

In order to minimize the memory usage of the in-memory journal, we can remove the entries from the Leader's journal
once it has been successfully replicated to ALL its followers.
This does not intefere with snapshots, as we capture snapshots on demand.

The followers follow the leader in cleaning the in-memory journal, there by ensuring that all the journals have more or less same entries.
This is done by the leader passing its replicatedToAllIndex as part of the AppendEntries.

Change-Id: I579a1f90d3c4e5d6be4ce699072688788b07bd48
Signed-off-by: Kamal Rameshan <kramesha@cisco.com>
9 years agoMerge "BUG 2667 : Handle null value type"
Tom Pantelis [Wed, 4 Feb 2015 16:11:01 +0000 (16:11 +0000)]
Merge "BUG 2667 : Handle null value type"

9 years agoBUG 2667 : Handle null value type
Moiz Raja [Tue, 3 Feb 2015 21:13:59 +0000 (13:13 -0800)]
BUG 2667 : Handle null value type

Modified the code to handle null types in leaf and leafset entries since
they are allowed. This should help avoid atleast some of the issues seen
by GBP.

Change-Id: Id24e03738e9b5490c8221fbf31ec0734c58655bb
Signed-off-by: Moiz Raja <moraja@cisco.com>
9 years agoAdd signature marker and version to NormalizedNode streaming
tpantelis [Mon, 2 Feb 2015 08:42:37 +0000 (03:42 -0500)]
Add signature marker and version to NormalizedNode streaming

For backwards compatibility, in some message classes, when
de-serializing, we first try the new NormalizedNode streaming and if
that fails we try the pre-Lithium protobuff de-serialization. However,
we're relying on an IOException from the NormalizedNode streaming or it
returning null which may not be reliable. In addition if protobuff fails
as well we can't tell if it's a bad protobuff or streamed message and we
squash the streaming exception. We don't want to masking streaming failures
as that's what will be used going forward.

To alleviate this, NormalizedNodeOutputStreamReader now writes an initial byte
as a signature marker to identify it as a valid stream.
NormalizedNodeInputStreamReader reads it, and if invalid, throws an
exception. This is caught by SerializationUtils as an indication to try
the legacy protobuff de-serialization.

Also, I added a version number to the output stream so we can handle
future changes for backwards compatibility.

Change-Id: I19779aa83c33eadc6bf83adfe6aae0b9a27cdfae
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoBug2268: Deprecate legacy Payload classes
tpantelis [Wed, 21 Jan 2015 21:18:17 +0000 (16:18 -0500)]
Bug2268: Deprecate legacy Payload classes

Mark CompositeModificationByteStringPayload and
CompositeModificationPayload as deprecated.

Change-Id: I788baab09770d305c9fde9b4988fad9e58663ded
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoBug 2268: Use streaming for Modification payload
tpantelis [Wed, 21 Jan 2015 19:45:42 +0000 (14:45 -0500)]
Bug 2268: Use streaming for Modification payload

Changed the *Modification classes to Externalizable and to use the
NormalizedNode streaming classes.

Added a new Payload implementation, ModificationPayload, that serializes the
Modification to a byte[].

Added ThreadLocals to SerializationUtils to reuse stream Reader/Writer
instances for efficiency for callers that serialize/deserialize multiple
objects.

Change-Id: Ib85af035d31027ffe4e2ddd5bcd49c1df1c6a42a
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoAdd serialVersionUUID fields
Robert Varga [Mon, 26 Jan 2015 18:09:53 +0000 (19:09 +0100)]
Add serialVersionUUID fields

Fix eclipse warnings by generating an explicit field.

Change-Id: Ice06a8ba6a2c59085998a725378d0ddd54cc032b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoNormalizedNodeOutputStreamWriter should forward flush()
Robert Varga [Mon, 26 Jan 2015 16:22:34 +0000 (17:22 +0100)]
NormalizedNodeOutputStreamWriter should forward flush()

When flush is called, we should cascade it to underlying stream, if it
is a stream. Failure to do so may cause problems with buffering.

Change-Id: I5ee32c3a0bab6aa112dc3c323ea1c4d5c4d5af5c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoCleanup PathArgumentTypes
Robert Varga [Mon, 26 Jan 2015 16:13:45 +0000 (17:13 +0100)]
Cleanup PathArgumentTypes

PathArgumentTypes is a utility class, it should be final with a private
constructor. Also make sure the internal map is truly constant.

Change-Id: I1cbbcac5c86daa64fc1fb79a7282fdd29b6566d7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoNodeTypes is a utility class
Robert Varga [Mon, 26 Jan 2015 16:10:44 +0000 (17:10 +0100)]
NodeTypes is a utility class

Utility classes need to be final and have a private constructor.

Change-Id: I4f7ad749415a068be324bfe23c79110b96c4ed10
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize MetricsReporter class
Robert Varga [Mon, 26 Jan 2015 16:00:59 +0000 (17:00 +0100)]
Optimize MetricsReporter class

Constants should really be static, singleton instance should be static
and the inner field should never be exposed to outside world.

Change-Id: I37776b190cef6b0402f1478b22c47746d547619d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize ValueSerializer
Robert Varga [Mon, 26 Jan 2015 15:08:14 +0000 (16:08 +0100)]
Optimize ValueSerializer

Instead of having a switch() statement, which forces a comparison of
ValueTypes, embed the serialize() method in ValueType with package
visibility.

Change-Id: I1cf4aa998cc97dc7d920570744094409aa4a7f29
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize ValueType class lookups
Robert Varga [Mon, 26 Jan 2015 14:54:23 +0000 (15:54 +0100)]
Optimize ValueType class lookups

Instead of using a mutable HashMap, use an ImmutableMap, which has much
better lookup performance.

Change-Id: Ia44ef5243abce021bdbd8afc930e5f5fc9529724
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize AugmentationIdentifierGenerator.getPathArguments()
Robert Varga [Mon, 26 Jan 2015 14:31:19 +0000 (15:31 +0100)]
Optimize AugmentationIdentifierGenerator.getPathArguments()

Instead of using a Regex-based splitting, instantiate a Splitter, which
is much faster.

Change-Id: I67c3cd1c9054f675b2543cb8ae62c7037f4edf19
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize PathUtils.toString()
Robert Varga [Mon, 26 Jan 2015 14:21:58 +0000 (15:21 +0100)]
Optimize PathUtils.toString()

- check for empty iterator and return empty string
- check iterator.hasNext() only once per iteration
- concatenate a single char instead of a string

Change-Id: If0769462d74a7df23373d12db5843fd2a217d5a9
Signed-off-by: Robert Varga <rovarga@cisco.com>