controller.git
9 years agoAdd features-restconf to mdsal-artifacts 91/14791/1
Ed Warnicke [Tue, 3 Feb 2015 22:18:21 +0000 (15:18 -0700)]
Add features-restconf to mdsal-artifacts

Change-Id: I1919153b372d2b7323fb1179ad04f9d3a491b29f
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoBUG 2667 : Handle null value type 89/14789/1
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 agoneutron now works with jetty 46/13546/7
Ed Warnicke [Wed, 10 Dec 2014 16:55:24 +0000 (10:55 -0600)]
neutron now works with jetty

This patch makes the feature neutron-northbound work with
jetty.

It also moves the adsal to port 8282, and the stock
karaf jetty to port 8080 (in additional to 8181).

GET, POST, and PUT for neutron network has been
tested:

GET:

curl -u admin:admin http://127.0.0.1:8080/controller/nb/v2/neutron/networks

POST:

curl -u admin:admin -H "Content-Type: application/json" -d @network.post http://127.0.0.1:8080/controller/nb/v2/neutron/networks

PUT:

curl -u admin:admin -H "Content-Type: application/json" -d @network2.post -X PUT  http://127.0.0.1:8080/controller/nb/v2/neutron/networks/d6220bbb-35f3-48ab-8eae-69c60aef3544

where:

cat network.post
{"network": {"status": "ACTIVE", "subnets": [], "name": "net-dedicated", "provider:physical_network": null, "admin_state_up": true, "tenant_id": "aa902936679e4ea29bfe1158e3450a13", "provider:network_type": "gre", "router:external": false, "shared": false, "id": "d6220bbb-35f3-48ab-8eae-69c60aef3544", "provider:segmentation_id": 1}}

cat network2.post
{"network": {"subnets": [], "name": "net-dedicated", "provider:physical_network": null, "admin_state_up": true, "provider:network_type": "gre", "router:external": true, "shared": false, "provider:segmentation_id": 1}}

This patch should not be merged before 2/1/2015 to allow time for discussion.

Change-Id: I6a003c2868adc5b060f05d228a56a744c092e963
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoMerge "Bug 2268: Serialize ApppendEntries"
Moiz Raja [Tue, 3 Feb 2015 18:50:27 +0000 (18:50 +0000)]
Merge "Bug 2268: Serialize ApppendEntries"

9 years agoMerge "Mark AD-SAL interfaces as deprecated"
Moiz Raja [Tue, 3 Feb 2015 18:35:54 +0000 (18:35 +0000)]
Merge "Mark AD-SAL interfaces as deprecated"

9 years agoFix potential issue with transaction timeouts 62/14662/4
tpantelis [Sat, 31 Jan 2015 04:52:15 +0000 (23:52 -0500)]
Fix potential issue with transaction timeouts

If CanCommit is sent for a transaction but there is already a current
transaction being committed, the second transaction is queued and
processed when the current transaction completes. However when the
second transaction is de-queued and CanComitted, the last access time
is not updated. There is a periodic timer task that checks if the current
transaction has not been accessed after a relatively long period of time
(eg if CanCommit was sent but Commit isn't sent possibly due to network
failure). In this case the current transaction is aborted. So if a
transaction was queued for a long enough period of time, when it becomes
the current transaction, the timer task could run and abort it before
the front-end has a chance to send the Commit. To prevent this, the
de-queued transaction's access time is updated when it it made the
current transaction.

I also changed the commit() and preCommit() calls to the InMemoryDataStore
to catch Exception as the InMemoryDataStore can throw unchecked
exceptions. If uncaught, the exception is propagated to akka and no
response is sent.

Change-Id: I516bde86f45272f2d40fab76acbc27180e2ad402
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoFix opendaylight-startup-archetype to use ${project.groupId} instead of ${groupId}. 03/14703/1
Nathan Harmon [Mon, 2 Feb 2015 23:40:11 +0000 (15:40 -0800)]
Fix opendaylight-startup-archetype to use ${project.groupId} instead of ${groupId}.

Change-Id: I3ce96492d149c466b93539e9254f93074e1f036c
Signed-off-by: Nathan Harmon <nathan.harmon@hp.com>
9 years agoMerge "Improve cluster test app logging"
Moiz Raja [Mon, 2 Feb 2015 23:37:36 +0000 (23:37 +0000)]
Merge "Improve cluster test app logging"

9 years agoAdd signature marker and version to NormalizedNode streaming 62/14862/2
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 agoBug 2410: Use generated serialVersionUID for messages 36/14836/2
tpantelis [Mon, 2 Feb 2015 03:10:19 +0000 (22:10 -0500)]
Bug 2410: Use generated serialVersionUID for messages

Changed the remaining message classes whose serialVersionUID had
previously been set to 1 to the generated value to maintain
backwards compatibility with Helium.

It turns out CommitEntry, PersistEntry, and SaveSnapShot are no longer
used so I removed them.

Change-Id: Ib3c251b7eaf8b8ce5aa4edf693aca23bf67d0402
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoRefactor TransactionProxy 18/14618/3
Gary Wu [Thu, 29 Jan 2015 22:24:18 +0000 (14:24 -0800)]
Refactor TransactionProxy

Consolidated three transaction operation interfaces
into one.  Eliminated creation of redundant future/promise
objects for queued read operations.

Change-Id: I12a91cac5298f2722e30ed52ee91e35fdf1104d6
Signed-off-by: Gary Wu <Gary.Wu1@huawei.com>
9 years agoImprove Shard logging output 60/14660/6
tpantelis [Fri, 30 Jan 2015 23:29:15 +0000 (18:29 -0500)]
Improve Shard logging output

When debugging it's useful to see the shard name in the log output.

Also changed ShardIdentifier to cache the toString() output as the
class is immutable so we don't incur the overhead of building the
String for every log message.

Change-Id: Ic7ea9878eeab04ea9b43a25b7d4b2b190f79e607
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoMark AD-SAL interfaces as deprecated 92/14392/4
Ed Warnicke [Thu, 22 Jan 2015 17:31:04 +0000 (10:31 -0700)]
Mark AD-SAL interfaces as deprecated

In keeping with TSC discussion on marking AD-SAL
deprecated during Lithium.

Change-Id: If0f7736dfe92833b51a1e223b705712d9b9f0271
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoBug2268: Deprecate legacy Payload classes 97/14497/2
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 2264: Use streaming for snapshots 20/14620/3
tpantelis [Thu, 29 Jan 2015 13:35:59 +0000 (08:35 -0500)]
Bug 2264: Use streaming for snapshots

The NormalizedNode snapshot payload is now streamed.

On the Shard side, added a new message CreateSnapsot to the
ShardReadTransaction to read the data tree root, serialize it, and
return a CaptureSnapshotReply message. On createSnapshot, the Shard
now sends the CreateSnapsot message to the read-only tx actor instead
of a ReadData message. This moves the serialization out of the Shard.

On the RaftActor side, the Snapshot class remained the same as it stores
a byte[] and is already Serializable. The CaptureSnapshotReply now
stores a byte[] instead of ByteString. The internal RaftActor code for
capture and apply snapshot was changed to use/pass byte[] to eliminate
the overhead of converting to/from ByteString.

Change-Id: Id12677441dce54bebbb5b71c68cf457d7c915ba1
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoBug 2268: Use streaming for Modification payload 95/14495/6
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 agoBug 2268: Serialize ApppendEntries 83/14483/5
tpantelis [Wed, 21 Jan 2015 20:12:24 +0000 (15:12 -0500)]
Bug 2268: Serialize ApppendEntries

Changed AppendEntries to use java serialization instead of protobuff to
take advantage of payload streaming. Kept backwards compatibility
support for deserializing from the pre-Lithium protobuff message.

Change-Id: Ia1edf186cbe8eba3f46207bcf3ba17598c5bca37
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoImprove cluster test app logging 63/14663/1
tpantelis [Sat, 31 Jan 2015 05:18:30 +0000 (00:18 -0500)]
Improve cluster test app logging

Made a few improvements to the logging in PeopleCarListener and
PeopleProvider to help debugging test failures.

Change-Id: I25d27e4abbc4b0096b2dc812bfcbada208c588e4
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoImprove JavaAttribute performance 13/14513/2
Robert Varga [Mon, 26 Jan 2015 17:05:37 +0000 (18:05 +0100)]
Improve JavaAttribute performance

Instead of performing Arrays.copyOf(), use the .clone() method, which is
guaranteed to return a shallow copy.

Change-Id: Ided53e90693b28f924c056189abd7257647fe079
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2650: Fix ConcurrentModificationEx in TransactionProxy 91/14591/3
tpantelis [Fri, 23 Jan 2015 09:44:07 +0000 (04:44 -0500)]
Bug 2650: Fix ConcurrentModificationEx in TransactionProxy

There were a couple patches proposed by other folks. Gary's patch
https://git.opendaylight.org/gerrit/#/c/14577/ to use a BlockingQueue
would work and is slightly simpler code but I prefer to avoid the unneeded synchronization
overhead that BlockingQueue carries as we still need explicit
synchronization for atomic access to txOperationsOnComplete and
transactionContext.

I implemented something similar to Robert's propopsal in
https://git.opendaylight.org/gerrit/#/c/14565/ .

I added a unit test that does a transaction put after an async read but
unfortunately it didn't reproduce the issue due to the behavior of the
akka dispatcher in the unit tests. The read future callback is batched
by the dispatcher even when using the CallingThreadDispatcher so the
synchronous read callback isn't achieved. Somehow the threading behavior
is different in the producton system. Regardless I kept the unit test
anyway - better than not haviing it.

Change-Id: I70f4e2507411c63cff99d03bf046c65e78a8138e
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoSplit out TransactionContext classes 73/14573/1
Robert Varga [Tue, 27 Jan 2015 15:13:36 +0000 (16:13 +0100)]
Split out TransactionContext classes

The classes are static and quite large, splitting them out into separate
files allows for better readability.

Change-Id: I12f6da96b7bf128549bf4d990bcc797fdb348f0d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix String.format() strings 31/14531/2
Robert Varga [Tue, 27 Jan 2015 10:59:50 +0000 (11:59 +0100)]
Fix String.format() strings

String.format() takes %s as a placeholder.

Change-Id: I1465b36b4d5ef56f25d3ee433450bbdd2ee97c3b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAdd serialVersionUUID fields 17/14517/3
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 agoFix a warning in CreateTransactionReply 16/14516/3
Robert Varga [Mon, 26 Jan 2015 18:09:15 +0000 (19:09 +0100)]
Fix a warning in CreateTransactionReply

Add a simple type argument to silence an eclipse warning.

Change-Id: Ib89c05ca6cc1161ac267313a559e5ae99605b090
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix ShardIdentifier warning 15/14515/3
Robert Varga [Mon, 26 Jan 2015 18:08:24 +0000 (19:08 +0100)]
Fix ShardIdentifier warning

The format string should be a constant, but we are not using it anyway.
Let's remmove it altogether and expand the corresponding comment.

Change-Id: I53245be3163ed3a874d14ddf981455dcd58c4ceb
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoNormalizedNodeOutputStreamWriter should forward flush() 05/14505/4
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 04/14504/4
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 03/14503/4
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 02/14502/4
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 agoMerge "Bug 2265: Use streaming for DeleteData message"
Moiz Raja [Wed, 28 Jan 2015 15:29:00 +0000 (15:29 +0000)]
Merge "Bug 2265: Use streaming for DeleteData message"

9 years agoMerge "Bug 2265: Address comments from 12448"
Moiz Raja [Wed, 28 Jan 2015 13:46:08 +0000 (13:46 +0000)]
Merge "Bug 2265: Address comments from 12448"

9 years agoMake sure write transaction cancellation is propagated 48/14548/2
Robert Varga [Tue, 27 Jan 2015 17:15:20 +0000 (18:15 +0100)]
Make sure write transaction cancellation is propagated

DOMForwardedWriteTransaction needs to notify subtransactions about
cancellation, as otherwise they will remain logically open and
potentially lost.

Change-Id: I15d926979fe181c60de65f44102b75513fd22dfc
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize ValueSerializer 99/14499/5
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 agoMerge "Optimize ValueType class lookups"
Tom Pantelis [Tue, 27 Jan 2015 14:23:51 +0000 (14:23 +0000)]
Merge "Optimize ValueType class lookups"

9 years agoMerge "Optimize AugmentationIdentifierGenerator.getPathArguments()"
Tom Pantelis [Tue, 27 Jan 2015 14:22:21 +0000 (14:22 +0000)]
Merge "Optimize AugmentationIdentifierGenerator.getPathArguments()"

9 years agoMerge "Optimize PathUtils.toString()"
Tom Pantelis [Tue, 27 Jan 2015 14:20:40 +0000 (14:20 +0000)]
Merge "Optimize PathUtils.toString()"

9 years agoMigrate AbstractRuntimeCodeGenerator to new ClassLoaderUtils 33/14533/1
Robert Varga [Tue, 27 Jan 2015 11:00:37 +0000 (12:00 +0100)]
Migrate AbstractRuntimeCodeGenerator to new ClassLoaderUtils

Change the import so we use the non-deprecated version. Also fix
exception string formatting.

Change-Id: Ibf710c8b59d633609c5f557604882034b63f4505
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize ValueType class lookups 98/14498/4
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() 94/14494/4
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() 93/14493/4
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>
9 years agoMerge "Optimize PathUtils.toYangInstanceIdentifier()"
Tom Pantelis [Tue, 27 Jan 2015 05:00:58 +0000 (05:00 +0000)]
Merge "Optimize PathUtils.toYangInstanceIdentifier()"

9 years agoMerge changes I66335247,I24ebd4b1,If2470ac2,Ia36e2a7c,If7549425, ...
Tom Pantelis [Tue, 27 Jan 2015 04:57:58 +0000 (04:57 +0000)]
Merge changes I66335247,I24ebd4b1,If2470ac2,Ia36e2a7c,If7549425, ...

* changes:
  Make sure QNameFactory cache is constant
  Use a singleton instance for DefaultShardStrategy
  Speedup ModuleShardStrategy a bit
  Optimize getAllShardNames()
  Optimize getShardNamesFromModuleName()
  Optimize getModuleNameToShardStrategyMap()
  Optimize getModuleNameFromNameSpace

9 years agoMerge "Improve ConfigurationImpl performance"
Tom Pantelis [Tue, 27 Jan 2015 04:56:28 +0000 (04:56 +0000)]
Merge "Improve ConfigurationImpl performance"

9 years agoMerge "Fix missing dependencies in opendaylight-startup archetype"
Tom Pantelis [Mon, 26 Jan 2015 19:42:51 +0000 (19:42 +0000)]
Merge "Fix missing dependencies in opendaylight-startup archetype"

9 years agoMerge "BUG 2518 : Throttle operations in a transaction"
Tom Pantelis [Mon, 26 Jan 2015 18:30:25 +0000 (18:30 +0000)]
Merge "BUG 2518 : Throttle operations in a transaction"

9 years agoFix missing dependencies in opendaylight-startup archetype 09/14509/2
Ed Warnicke [Mon, 26 Jan 2015 16:48:03 +0000 (09:48 -0700)]
Fix missing dependencies in opendaylight-startup archetype

Change-Id: I3ebc2240f89ae0bb4baddb658b0942200d4e7c20
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoOptimize PathUtils.toYangInstanceIdentifier() 92/14492/1
Robert Varga [Mon, 26 Jan 2015 14:07:13 +0000 (15:07 +0100)]
Optimize PathUtils.toYangInstanceIdentifier()

Instead of using String-bases split, use a guava splitter.

Change-Id: I6eb184d5e3a3ece93588267ba231a42b90d6bb9d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMake sure QNameFactory cache is constant 91/14491/1
Robert Varga [Mon, 26 Jan 2015 14:00:58 +0000 (15:00 +0100)]
Make sure QNameFactory cache is constant

The cache is constant, there is no reason it should be non-final.

Change-Id: I663352473e6a9e6021c3cee56ddf0336e5f8e2ac
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoUse a singleton instance for DefaultShardStrategy 90/14490/1
Robert Varga [Mon, 26 Jan 2015 13:45:30 +0000 (14:45 +0100)]
Use a singleton instance for DefaultShardStrategy

Instead of instantiating the DefaultShardStrategy everywhere it is used,
share a singleton instance.

Change-Id: I24ebd4b1d713a09b4fc4161e9c8c69a088af5ac6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSpeedup ModuleShardStrategy a bit 89/14489/1
Robert Varga [Mon, 26 Jan 2015 13:40:23 +0000 (14:40 +0100)]
Speedup ModuleShardStrategy a bit

Using isEmpty() is a bit faster, as it allows us to side-step a
subsequent comparison.

Change-Id: If2470ac293f0678e7bf158fccc00f263ed73a207
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize getAllShardNames() 88/14488/1
Robert Varga [Mon, 26 Jan 2015 13:24:24 +0000 (14:24 +0100)]
Optimize getAllShardNames()

Instead of iterating through all shards, cache the result of
getAllShardNames().

Change-Id: Ia36e2a7cbae39e7e6862e57d93532b7b59c7863b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize getShardNamesFromModuleName() 87/14487/1
Robert Varga [Mon, 26 Jan 2015 13:07:32 +0000 (14:07 +0100)]
Optimize getShardNamesFromModuleName()

Instead of creating the list each and everytime, take advantage of the
fact the inputs are constants -- and pre-instantiate a map.

Change-Id: If754942561a186fa1ca7806fe86834a3530a97ca
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize getModuleNameToShardStrategyMap() 86/14486/1
Robert Varga [Mon, 26 Jan 2015 12:53:04 +0000 (13:53 +0100)]
Optimize getModuleNameToShardStrategyMap()

This map is based on constant data and can be easily pre-computed. Do
precisely that.

Change-Id: Ic3851034ca3ccd752c3f4afc0d1d3c77a9df9e65
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoImprove ConfigurationImpl performance 84/14484/1
Robert Varga [Mon, 26 Jan 2015 10:42:06 +0000 (11:42 +0100)]
Improve ConfigurationImpl performance

This makes initialization of modules and moduleShards into an obvious
constant, which can drive further optimization.

Change-Id: I9bb73644967fb1f8129ca9739e842b3ce847a0e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize getModuleNameFromNameSpace 85/14485/1
Robert Varga [Mon, 26 Jan 2015 12:48:52 +0000 (13:48 +0100)]
Optimize getModuleNameFromNameSpace

Instead of looking up in the global array which is constant,
pre-construct a constant lookup map.

Change-Id: I85d54332b0a3b717d33da9758eaafbce5bd5595d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG 2518 : Throttle operations in a transaction 55/14155/4
Moiz Raja [Wed, 14 Jan 2015 23:21:35 +0000 (15:21 -0800)]
BUG 2518 : Throttle operations in a transaction

In some use cases a single transaction may do a lot of operations
in a short period of time. This happens for example when testing
the bgp-plugin. To ensure that clients do not overwhelm the datastore
this patch throttles operations on the transaction proxy side and
prevents the client from sending more operations than can be handled
by the ShardTransaction actor in a reasonable amount of time.

The throttling serves as a back-pressure mechanism. Akka recommends
that for back pressure we use a bounded mailbox with an adequate
push timeout. We are doing this. However the akka's behavior on the
timeout expiring is to send the throttled message to dead letters.
So to properly do what akka expects us to do we would need to watch
dead letters and use that as an indication that we need back pressure
which I think is inadequate for our purpose and thus the Semaphore
based throttling.

Change-Id: Ib1a0f128ffde009a82b8cd67001203e0b959fdf5
Signed-off-by: Moiz Raja <moraja@cisco.com>
9 years agoMerge changes I3e404877,Ida2a5c32,I9e6ce426,I6a4b90f6,I79717533
Tony Tkacik [Mon, 26 Jan 2015 09:04:20 +0000 (09:04 +0000)]
Merge changes I3e404877,Ida2a5c32,I9e6ce426,I6a4b90f6,I79717533

* changes:
  Change trackerList to a LinkedList
  Improve AbstractLeader tracker removal
  use AtomicLongfieldUpdater in FollowerLogInformationImpl
  Use an ImmutableList instance for getFrom()
  Hide AbstractReplicatedLogImpl index fields

9 years agoMerge changes I880310f2,I9f437328,I552372db,I587fb203,I05f0bd94, ...
Tony Tkacik [Mon, 26 Jan 2015 08:51:18 +0000 (08:51 +0000)]
Merge changes I880310f2,I9f437328,I552372db,I587fb203,I05f0bd94, ...

* changes:
  Do not leak AtomicLong from FollowerLogInformation
  Remove followers as an explicit field
  Hide AbstractLeader maps
  Hide internals of FollowerLogInformationImpl
  Speedup AbstractLeader.printFollowerStates()
  Improve RpcInvocationStrategy performance

9 years agoMerge "Bug 2265: Use new NormalizedNode streaming in messages"
Moiz Raja [Mon, 26 Jan 2015 03:57:54 +0000 (03:57 +0000)]
Merge "Bug 2265: Use new NormalizedNode streaming in messages"

9 years agoChange trackerList to a LinkedList 74/14474/1
Robert Varga [Sun, 25 Jan 2015 08:50:11 +0000 (09:50 +0100)]
Change trackerList to a LinkedList

The trackers are being added to the end and usually remove in a linear
fashion. An ArrayList's remove() method makes sure the backing array is
packed -- which means we end up copying the array over and over again.

Changing the trackerList to a LinkedList removes the need for copying at
the expense of memory footprint and cache locality.

Change-Id: I3e40487798eb64713ed4526f53a0a8c385a9a778
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoImprove AbstractLeader tracker removal 58/14458/3
Robert Varga [Fri, 23 Jan 2015 18:57:47 +0000 (19:57 +0100)]
Improve AbstractLeader tracker removal

The remove operation performs a linear lookup by index and perform a
second iteration to find the object again. Instead of that, instantiate
an iterator and use its remove() method to elide the second lookup.

Change-Id: Ida2a5c327115d2da787e397311c0a0c5a46a0d43
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agouse AtomicLongfieldUpdater in FollowerLogInformationImpl 59/14459/3
Robert Varga [Fri, 23 Jan 2015 19:10:44 +0000 (20:10 +0100)]
use AtomicLongfieldUpdater in FollowerLogInformationImpl

Instead of keeping two AtomicLong instances, we instantiate two shared
updater classes and keep the values in volatile fields. This lowers the
memory consumption.

Change-Id: I9e6ce426500ee61b8c02d75cb0edd361e996a443
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoUse an ImmutableList instance for getFrom() 56/14456/3
Robert Varga [Fri, 23 Jan 2015 17:17:14 +0000 (18:17 +0100)]
Use an ImmutableList instance for getFrom()

Since we are creating a view, we do not need to allocate a larger list
-- just use a copy constructor, which will create an
appropriately-sized copy.

Change-Id: I6a4b90f638b3f8511b5ec641ab5f9b1f14632407
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoHide AbstractReplicatedLogImpl index fields 55/14455/3
Robert Varga [Fri, 23 Jan 2015 16:51:42 +0000 (17:51 +0100)]
Hide AbstractReplicatedLogImpl index fields

The fields have proper getter/setter methods, there is no need to expose
them anywhere.

Change-Id: I7971753310dfe8c8654caeef04cfc38dfddeef86
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDo not leak AtomicLong from FollowerLogInformation 46/14446/3
Robert Varga [Fri, 23 Jan 2015 14:57:33 +0000 (15:57 +0100)]
Do not leak AtomicLong from FollowerLogInformation

Leaking this implementation details allows callers to interact with
state outside of the official contract. Disallow that.

Change-Id: I880310f2a9692fd11ba2cd33830501d19d0a1b65
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove followers as an explicit field 45/14445/3
Robert Varga [Fri, 23 Jan 2015 14:46:51 +0000 (15:46 +0100)]
Remove followers as an explicit field

The field corresponds to followerToLog.keySet(), which is immutable, so
there is no point in retaining it in a field. It allows us to realize
that we can use an entrySet() and prevent lookups to get corresponding
information.

Change-Id: I9f43732813b61d19306ef5954a97c9c8cd64ccfb
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoHide AbstractLeader maps 43/14443/3
Robert Varga [Fri, 23 Jan 2015 14:17:31 +0000 (15:17 +0100)]
Hide AbstractLeader maps

Collections should never be leaked, as they introduce the ability to
make unsynchronized changes. This patch hides the map itself, allowing
lookups.

Once we have done that, we have control over the interactions and thus
can see that the map is instantiation-constant. Use an ImmutableMap to
maintain the entries as it provides superior compactness and lookup
speeds.

Change-Id: I552372dbabe454111909bb8251637e9f3c0e0db7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoHide internals of FollowerLogInformationImpl 42/14442/3
Robert Varga [Fri, 23 Jan 2015 13:53:55 +0000 (14:53 +0100)]
Hide internals of FollowerLogInformationImpl

The constructor should not take AtomicLong instances, as that is an
implementation-specific detail. Notably the constructor assumes
ownership of the objects and no caller uses them in a shared way.

Change-Id: I587fb2033f9b513df565471f037e20e0acc481c7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSpeedup AbstractLeader.printFollowerStates() 41/14441/3
Robert Varga [Fri, 23 Jan 2015 13:49:12 +0000 (14:49 +0100)]
Speedup AbstractLeader.printFollowerStates()

Instead of using string concat to append to a StringBuilder and then
concat the result of the builder, perform proper construction and
instantiate only a single string.

Change-Id: I05f0bd9404a3d6470a0b9d0b1ea71595dcba5cc0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoImprove RpcInvocationStrategy performance 20/14420/4
Robert Varga [Fri, 23 Jan 2015 08:02:29 +0000 (09:02 +0100)]
Improve RpcInvocationStrategy performance

As it turns out, the transformation function can easily be shared,
reducing the amount of objects we create.

Change-Id: I76c86e2f0c63e87c87677ac739f980a5e7929d3f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoUse ImmutableSet in ShardManager 29/14429/2
Robert Varga [Fri, 23 Jan 2015 11:10:39 +0000 (12:10 +0100)]
Use ImmutableSet in ShardManager

Instead of mutating the same set, use a space-optimized immutable view
and update that.

Change-Id: Iae0615580f93bb8e215d929e72abeb17f8b3eed0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize ActorContext a bit 24/14424/1
Robert Varga [Fri, 23 Jan 2015 10:14:26 +0000 (11:14 +0100)]
Optimize ActorContext a bit

Do not perform .toString() on objects passed to loggers -- it will be
invoked automatically if the message is not filtered.

Use a simple character lookup instead of a string.

Change-Id: I262298c767a1363daf3c8f7e83f994e70e0cf6bf
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoLower Shard.DEFAULT_NAME visibility 27/14427/1
Robert Varga [Fri, 23 Jan 2015 10:33:22 +0000 (11:33 +0100)]
Lower Shard.DEFAULT_NAME visibility

Add an annotation which clarifies that the DEAFULT_NAME is only ever
used in tests.

Change-Id: I786a2e747e4f52ac4577a94fd268e13a191e07e9
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoClarify DistributedDataStoreFactory 26/14426/1
Robert Varga [Fri, 23 Jan 2015 10:31:14 +0000 (11:31 +0100)]
Clarify DistributedDataStoreFactory

DistributedDataStoreFactory used an atomic reference to manage a lazy
initialization of a singleton, which could fail to initialize. Use an
explicit volatile and lower synchronization requirements when the
singleton has already been initialized.

Change-Id: I10c38ca2441c6e7d8251560f9ea1218211490fc9
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSpeed up ClusterWrapperImpl 25/14425/1
Robert Varga [Fri, 23 Jan 2015 10:18:06 +0000 (11:18 +0100)]
Speed up ClusterWrapperImpl

Instead of forcing a Set.toArray(), just pick the first entry in
iteration order.

Change-Id: If564ee3695707ad2482845bc8610693722e27943
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Remove unnecessary declaration of <prerequisites> in protocol-framework"
Tony Tkacik [Fri, 23 Jan 2015 11:09:39 +0000 (11:09 +0000)]
Merge "Remove unnecessary declaration of <prerequisites> in protocol-framework"

9 years agoMerge "Remove unnecessary declaration of <prerequisites> in commons.parent"
Tony Tkacik [Fri, 23 Jan 2015 11:09:29 +0000 (11:09 +0000)]
Merge "Remove unnecessary declaration of <prerequisites> in commons.parent"

9 years agoMerge "Remove unnecessary declaration of <prerequisites> in archetypes"
Tony Tkacik [Fri, 23 Jan 2015 11:09:20 +0000 (11:09 +0000)]
Merge "Remove unnecessary declaration of <prerequisites> in archetypes"

9 years agoMerge "Remove unnecessary declaration of <prerequisites> in itests"
Tony Tkacik [Fri, 23 Jan 2015 11:09:11 +0000 (11:09 +0000)]
Merge "Remove unnecessary declaration of <prerequisites> in itests"

9 years agoMerge "Remove unnecessary declaration of <prerequisites> in features"
Tony Tkacik [Thu, 22 Jan 2015 16:19:05 +0000 (16:19 +0000)]
Merge "Remove unnecessary declaration of <prerequisites> in features"

9 years agoMerge "Use Maven Enforcer plugin to require Maven version"
Tony Tkacik [Thu, 22 Jan 2015 16:17:46 +0000 (16:17 +0000)]
Merge "Use Maven Enforcer plugin to require Maven version"

9 years agoRemove unnecessary declaration of <prerequisites> in protocol-framework 25/14225/2
Thanh Ha [Mon, 19 Jan 2015 03:34:15 +0000 (22:34 -0500)]
Remove unnecessary declaration of <prerequisites> in protocol-framework

Bug: 2605
Change-Id: I26a1a5434dfdb3d4e28bfd141f575991a8e91f03
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
9 years agoRemove unnecessary declaration of <prerequisites> in commons.parent 24/14224/2
Thanh Ha [Mon, 19 Jan 2015 03:33:20 +0000 (22:33 -0500)]
Remove unnecessary declaration of <prerequisites> in commons.parent

Bug: 2605
Change-Id: I41969c105d03af308704a2f00f84f45596e99493
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
9 years agoRemove unnecessary declaration of <prerequisites> in archetypes 23/14223/2
Thanh Ha [Mon, 19 Jan 2015 03:31:57 +0000 (22:31 -0500)]
Remove unnecessary declaration of <prerequisites> in archetypes

Bug: 2605
Change-Id: Iec369017515eca4380164558ecb6733d39235a3c
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
9 years agoRemove unnecessary declaration of <prerequisites> in itests 22/14222/2
Thanh Ha [Mon, 19 Jan 2015 03:28:22 +0000 (22:28 -0500)]
Remove unnecessary declaration of <prerequisites> in itests

Bug: 2605
Change-Id: I43f82e0f26ff0d9e41c338c662edb64d04df690b
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
9 years agoRemove unnecessary declaration of <prerequisites> in features 21/14221/2
Thanh Ha [Mon, 19 Jan 2015 03:26:19 +0000 (22:26 -0500)]
Remove unnecessary declaration of <prerequisites> in features

Bug: 2605
Change-Id: Ie17b660d81bbdce5a9f9cfd98bd8d0b5d2593919
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
9 years agoBug 2265: Use streaming for DeleteData message 76/14476/3
tpantelis [Wed, 21 Jan 2015 18:31:12 +0000 (13:31 -0500)]
Bug 2265: Use streaming for DeleteData message

The WriteData and MergeData messages were changed to use streaming. We
might as well do it for DeleteData as well as the YangInstanceIdentifier
streaming is faster.

Change-Id: Ie48662ecc5c8a83734f3155ca8067d25bb153058
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoBug 2265: Address comments from 12448 10/14510/1
tpantelis [Wed, 21 Jan 2015 22:44:19 +0000 (17:44 -0500)]
Bug 2265: Address comments from 12448

Address comments from https://git.opendaylight.org/gerrit/#/c/12448/:

- CanCommitTransactionReply: "you could have used a CONSTANT here
YES_SERIALIZED, NO_SERIALIZED. Or even completely eliminating the
serializedMessage field"

- MergeData: "We could have use SERIALIZABLE_CLASS.isInstance(message)
here and in lot of other places where we are checking the message
type with equals now."

Change-Id: I8248fb739b45a9ad4795b355f3b4ef9291e99791
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoUse Maven Enforcer plugin to require Maven version 20/14220/2
Thanh Ha [Mon, 19 Jan 2015 03:22:56 +0000 (22:22 -0500)]
Use Maven Enforcer plugin to require Maven version

Using the <prerequisites> configuration in pom files is deprecated and
it is recommended to use the maven-enforcer-plugin to enforce these
rules instead.

See:
http://jira.codehaus.org/browse/MNG-5297
http://jira.codehaus.org/browse/MNG-4840

Bug: 2605
Change-Id: Ia0be6681bfac19d3a49917e172e32a26ac8e5933
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
9 years agoMore unit test code coverage for NormalizedNodeStreamReader/Writer 36/14336/3
tpantelis [Sun, 18 Jan 2015 19:29:11 +0000 (14:29 -0500)]
More unit test code coverage for NormalizedNodeStreamReader/Writer

Change-Id: Id93186bb8de8dd7fadb4a53679f964697bd45e3c
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoMerge changes Iae061558,I786a2e74,I10c38ca2
Moiz Raja [Sun, 25 Jan 2015 23:17:45 +0000 (23:17 +0000)]
Merge changes Iae061558,I786a2e74,I10c38ca2

* changes:
  Use ImmutableSet in ShardManager
  Lower Shard.DEFAULT_NAME visibility
  Clarify DistributedDataStoreFactory

9 years agoMerge "Speed up ClusterWrapperImpl"
Moiz Raja [Sun, 25 Jan 2015 20:11:17 +0000 (20:11 +0000)]
Merge "Speed up ClusterWrapperImpl"

9 years agoMerge "Bug 2327: Handle binary data in NormalizedNode streaming"
Moiz Raja [Sun, 25 Jan 2015 19:58:35 +0000 (19:58 +0000)]
Merge "Bug 2327: Handle binary data in NormalizedNode streaming"

9 years agobug 2616 - NPE in ControllerContext.toQName method 26/14326/2
Vaclav Demcak [Wed, 21 Jan 2015 09:55:14 +0000 (10:55 +0100)]
bug 2616 - NPE in ControllerContext.toQName method

Method works with globalSchema property without validation and somtimes it could be null.

- add a missing check method call for toQName method
- add a missing check method call for collectPathArguments method (mountpoint - line 549)

Change-Id: I4a568bbeb54720592ef42990d7dcd430df170c12
Signed-off-by: Vaclav Demcak <vdemcak@cisco.com>
9 years agoBug 2265: Use new NormalizedNode streaming in messages 48/12448/19
tpantelis [Mon, 19 Jan 2015 03:21:46 +0000 (22:21 -0500)]
Bug 2265: Use new NormalizedNode streaming in messages

    Utilized the new NormalizedNode streaming classes for the WriteData,
    MergeData, ReadDataReply and DataChanged messages.

    One solution was to add a bytes field to the protobuff messages and
    make the previous fields optional. For backwards compatibility, in
    the wrapper message's fromSerializable method, check whether or not
    the protobuff message has the bytes field and act accordingly.

    While this works, it results in an undesirable inefficiency.
    Protobuff translates the bytes field to a ByteString type. So when
    streaming, we need to create a ByteArrayOutputStream and pass that to
    the NormalizedNode stream writer. Then call
    ByteString.copyFrom(bos.toByteArray) to get the resulting ByteString.
    However this results in 2 copies of the serialized byte[]. The
    byte[] cannot be passed to ByteString as is as it always copies it to
    maintain immutability. I looked into subclassing ByteString and
    lazily streaming the data on demand but the ByteString ctor is
    package scoped so they don’t allow subclassing.

    So I went with an approach to make each message Externalizable
    instead of using protobuff. The classes writes
    the version number to enable us to handle compatibility in the future.
    So in this manner, we can get the efficient direct streaming we
    want and easily handle backwards and forwards compatibility.

    I added a VersionedSerializableMessage interface whose
    toSerializable method takes a version number. The version # is passed
    from the remote version # obtained from the CreateTransactionReply.
    This allows the message classes to handle backwards compatibility. So
    if the version is Helium-1 or less, send the protobuff message
    otherwise send the Externalizable instance.

    In the fromSerializable method, it checks if the passed Object is an
    instance of the Externalizable class or the protbuff message type.

Change-Id: I5ebb968e70ac8ff92c29183c52e6c3fe5362ae34
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoMerge "Fixed bug in generated artifactId for ${artifactId}-karaf"
Moiz Raja [Wed, 21 Jan 2015 01:23:22 +0000 (01:23 +0000)]
Merge "Fixed bug in generated artifactId for ${artifactId}-karaf"

9 years agoFix typo in 05-clustering.xml file 69/14469/1
tpantelis [Wed, 21 Jan 2015 00:45:46 +0000 (19:45 -0500)]
Fix typo in 05-clustering.xml file

The 05-clustering.xml file fails to load - in the capabilities section
"distributed-datastore-privider" should be
"distributed-datastore-provider".

Change-Id: I28082e8a658bbb6e04714da5346d08e33678d6a4
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoFixed bug in generated artifactId for ${artifactId}-karaf 10/14310/1
Ed Warnicke [Tue, 20 Jan 2015 19:25:58 +0000 (12:25 -0700)]
Fixed bug in generated artifactId for ${artifactId}-karaf

Change-Id: I754a7804a2cc3c9ef2b19f29b313034517462ab4
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoMerge "Added sun.misc to jre.properties"
Tony Tkacik [Tue, 20 Jan 2015 18:04:31 +0000 (18:04 +0000)]
Merge "Added sun.misc to jre.properties"

9 years agoMerge "BUG 2585 : Make Election Timeout Factor configurable"
Tom Pantelis [Tue, 20 Jan 2015 17:45:33 +0000 (17:45 +0000)]
Merge "BUG 2585 : Make Election Timeout Factor configurable"