mdsal.git
9 years agoBug 2347: Minor fixes to correct log output
tpantelis [Thu, 13 Nov 2014 02:57:49 +0000 (21:57 -0500)]
Bug 2347: Minor fixes to correct log output

DOMConcurrentDataCommitCoordinator#handleException hard-codes the error
mapper to CAN_COMMIT_ERROR_MAPPER however this should be passed
in corresponding to the phase.

In TransactionCommitFailedExceptionMapper, the opNames for
PRE_COMMIT_MAPPER and CAN_COMMIT_ERROR_MAPPER are reversed, should be
"preCommit", "canCommit" respectively.

Change-Id: I6c0513f0f6265ec19de39476c95efefee53d2ee1
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoMerge "Bug 2347: DOMConcurrentDataCommitCoordinator uses wrong phase name"
Moiz Raja [Wed, 12 Nov 2014 18:14:29 +0000 (18:14 +0000)]
Merge "Bug 2347: DOMConcurrentDataCommitCoordinator uses wrong phase name"

9 years agoBug 2347: DOMConcurrentDataCommitCoordinator uses wrong phase name
tpantelis [Wed, 12 Nov 2014 16:21:40 +0000 (11:21 -0500)]
Bug 2347: DOMConcurrentDataCommitCoordinator uses wrong phase name

Change-Id: I8b9083a428553525861137fc8630635f6508c2dc
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoMerge "Remove dead code in RuntimeMappingModule"
Tony Tkacik [Mon, 10 Nov 2014 08:54:36 +0000 (08:54 +0000)]
Merge "Remove dead code in RuntimeMappingModule"

9 years agoMerge "Do not override managed versions"
Tony Tkacik [Mon, 10 Nov 2014 08:54:13 +0000 (08:54 +0000)]
Merge "Do not override managed versions"

9 years agoRemove dead code in RuntimeMappingModule
Robert Varga [Fri, 7 Nov 2014 19:27:49 +0000 (20:27 +0100)]
Remove dead code in RuntimeMappingModule

RuntimeMappingModule.RuntimeGeneratedMappingServiceProxy is private and
not used locally. Remove it, as it also uses deprecated classes -- thus
eliminating quite a few eclipse warnings.

Change-Id: Ica5d11dfceb34435af30811c79f9c2bd194575a8
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge changes I52c2aaab,I2509ed5e,Ic1d8a4e5,I73730f79,Ica1959e5,I0ce61b07
Tony Tkacik [Sat, 8 Nov 2014 16:06:15 +0000 (16:06 +0000)]
Merge changes I52c2aaab,I2509ed5e,Ic1d8a4e5,I73730f79,Ica1959e5,I0ce61b07

* changes:
  Fix a raw Dictionary reference
  Fix a raw Enumeration reference
  Fix a non-generic CheckedFuture
  Access static methods via class
  Remove unused local variable
  Fix non-generic references to Optional

9 years agoMerge "Do not create Map subclasses"
Tony Tkacik [Sat, 8 Nov 2014 15:59:58 +0000 (15:59 +0000)]
Merge "Do not create Map subclasses"

9 years agoFix non-generic references to Optional
Robert Varga [Fri, 7 Nov 2014 17:09:24 +0000 (18:09 +0100)]
Fix non-generic references to Optional

Just adds arguments as needed.

Change-Id: I0ce61b07e3286a2d3415c92bbbe5e5bc28b5baef
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDo not create Map subclasses
Robert Varga [Fri, 7 Nov 2014 19:34:56 +0000 (20:34 +0100)]
Do not create Map subclasses

Rather than using subclasses for initialization, which require a serial
version, populate them normally -- thus fixing warnings.

Change-Id: Ia204b3ed6a58acaee1de2f1d780a9421cd0eea8f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDo not override managed versions
Robert Varga [Fri, 7 Nov 2014 18:03:48 +0000 (19:03 +0100)]
Do not override managed versions

This fixes pom.xmls to not override managed versions. Should not result
in any version shift.

Change-Id: I0e30541f71118b8ec024b941b1f04e098f0b7179
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Update junit Assert imports"
Tony Tkacik [Fri, 7 Nov 2014 14:30:42 +0000 (14:30 +0000)]
Merge "Update junit Assert imports"

9 years agoUpdate junit Assert imports
Robert Varga [Fri, 7 Nov 2014 12:42:30 +0000 (13:42 +0100)]
Update junit Assert imports

JUnit 4.11 has moved Assert to org.junit, and deprecated
junit.framework.Assert. This adjust the imports to fix the warnings.

Change-Id: Iecbf2a1b4ae097989e840ad6f6d5bf759c521639
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAdd generic arguments to Answer
Robert Varga [Thu, 6 Nov 2014 12:42:11 +0000 (13:42 +0100)]
Add generic arguments to Answer

Just use Object as the argument to get rid of the warnings.

Change-Id: I17d2ee9c518ed53c27bd5e1c330e7c161a388194
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Introduce forwarding DOMData classes"
Tony Tkacik [Fri, 7 Nov 2014 10:30:22 +0000 (10:30 +0000)]
Merge "Introduce forwarding DOMData classes"

9 years agoMerge "Fix a typo in javadoc"
Tony Tkacik [Fri, 7 Nov 2014 10:29:10 +0000 (10:29 +0000)]
Merge "Fix a typo in javadoc"

9 years agoMerge "Bug 2233 - RPC register exception when rpc has no input"
Tony Tkacik [Fri, 7 Nov 2014 10:18:49 +0000 (10:18 +0000)]
Merge "Bug 2233 - RPC register exception when rpc has no input"

9 years agoIntroduce forwarding DOMData classes
Robert Varga [Thu, 6 Nov 2014 14:31:36 +0000 (15:31 +0100)]
Introduce forwarding DOMData classes

These classes are useful for implementing various decorator. Their sole
functionality is to forward calls to a backing instance.

Change-Id: I8a65283ab6e3f9787dc59f43d7b7e8eb37459538
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix a typo in javadoc
Robert Varga [Thu, 6 Nov 2014 14:30:54 +0000 (15:30 +0100)]
Fix a typo in javadoc

Simple typo.

Change-Id: I9934e8674b0bb9c2dc8a28dcb189c213e7709cb9
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2233 - RPC register exception when rpc has no input
Jan Hajnar [Fri, 31 Oct 2014 12:59:08 +0000 (13:59 +0100)]
Bug 2233 - RPC register exception when rpc has no input

* added check that should prevent non routed Rpcs being treated as
routed and and failing at context resolution.

Change-Id: I281152879429f2020f48894753f1d57aea85bde6
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
9 years agoMerge "Cleanup RpcRoutingStrategy definition"
Tony Tkacik [Mon, 27 Oct 2014 09:28:04 +0000 (09:28 +0000)]
Merge "Cleanup RpcRoutingStrategy definition"

9 years agoMerge "Bug 2160: Added concurrent 3-phase commit coordinator"
Moiz Raja [Fri, 17 Oct 2014 16:20:25 +0000 (16:20 +0000)]
Merge "Bug 2160: Added concurrent 3-phase commit coordinator"

9 years agoMerge "Bug 865: Fixed use of removed deprecated YANGInstanceIdentifier methods."
Tony Tkacik [Fri, 17 Oct 2014 13:35:10 +0000 (13:35 +0000)]
Merge "Bug 865: Fixed use of removed deprecated YANGInstanceIdentifier methods."

9 years agoBug 865: Fixed use of removed deprecated YANGInstanceIdentifier methods.
Tony Tkacik [Fri, 17 Oct 2014 12:05:06 +0000 (14:05 +0200)]
Bug 865: Fixed use of removed deprecated YANGInstanceIdentifier methods.

Some components in controller still used methods which was deprecated
before Helium and was removed after Helium was released to accomodate
API changes for 0.7.0 Yangtools. This patch migrates code to replacement
methods.

Change-Id: I146a08caefeb0d666223cf66600a4342a5b49165
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-2006: Rework state tracking"
Tony Tkacik [Fri, 17 Oct 2014 09:17:35 +0000 (09:17 +0000)]
Merge "BUG-2006: Rework state tracking"

9 years agoBUG-2006: Rework state tracking
Robert Varga [Thu, 18 Sep 2014 13:53:24 +0000 (15:53 +0200)]
BUG-2006: Rework state tracking

Separate out the two embedded classes to allow easier analysis of
interactions. Introduce a state-tracking class within
DOMStoreTransactionChainImpl with three distinct states: Idle, Allocated
and Shutdown. The allocated state has an internal sub-state when the
transaction has been readied. Perform atomic state transitions using
compare-and-swap.

Change-Id: I4b852d42455d7e07076c56af3626f804ba572770
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoCleanup RpcRoutingStrategy definition
Robert Varga [Wed, 17 Sep 2014 12:44:20 +0000 (14:44 +0200)]
Cleanup RpcRoutingStrategy definition

Adds preconditions and final keywords as appropriate, removes single-use
private static constructors.

Change-Id: If3bc7c46cb46edb1e2059453f42e1bfc521af46d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2160: Added concurrent 3-phase commit coordinator
tpantelis [Tue, 7 Oct 2014 13:34:01 +0000 (09:34 -0400)]
Bug 2160: Added concurrent 3-phase commit coordinator

Added a new class DOMConcurrentDataCommitCoordinator which is an
implementation of DOMDataCommitExecutor that allows multiple concurrent
3-phase transaction commits. The 3 phases are still performed serially and
non-blocking per transaction.

A new flag, "allow-concurrent-commits", was added to the DOM in-memory
data broker's yang config. If true, the new
DOMConcurrentDataCommitCoordinator implementation is used, otherwise the
current implementation is used. The default is false.

The distributed data store will use the concurrent coordinator.

Change-Id: Ie21947d6f9c1086f89686a73442c854c08c07100
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoIncrementing versions by 0.1.0 for post-Helium master branch
Colin Dixon [Fri, 3 Oct 2014 22:55:46 +0000 (17:55 -0500)]
Incrementing versions by 0.1.0 for post-Helium master branch

* The only version not incrmented is aaa.version, which is left at
  0.1.0-SNAPSHOT since they depend on controller and can't update yet.
* To break the cyclic dependency, this patch temporarily stops running
  the netconf-connector and restconf feature tests.
* Also fixing a bug causing Errors like "Choice has two nodes case with
  same qnames".

A second patch (to be run after AAA increments their versions to
0.2.0-SNAPSHOT) wiil update aaa.version and re-enable these tests.

Change-Id: I70a3987d32504e798c5ed05a67a0a1174338844b
Signed-off-by: Colin Dixon <colin@colindixon.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1845: implement proper shutdown sequence"
Tony Tkacik [Mon, 22 Sep 2014 14:13:03 +0000 (14:13 +0000)]
Merge "BUG-1845: implement proper shutdown sequence"

9 years agoBUG-1845: implement proper shutdown sequence
Robert Varga [Thu, 18 Sep 2014 17:35:52 +0000 (19:35 +0200)]
BUG-1845: implement proper shutdown sequence

The notification chain should only invoke the successful callback once
all transactions have been committed successfully. This patch does
precisely that by tracking the number of outstanding transactions. Since
this requires notification about successful transactions, too, we get
rid of the unneeded DOMDataCommitErrorInvoker/Listener abstraction.

Change-Id: I38534a3fb79a8a461059504de7b0cdd48348afef
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 1763: Fixed illegal state in Binding Transaction Chain."
Ed Warnicke [Thu, 18 Sep 2014 16:02:48 +0000 (16:02 +0000)]
Merge "Bug 1763: Fixed illegal state in Binding Transaction Chain."

9 years agoBUG-509: remove HashMapDataStore
Robert Varga [Sun, 14 Sep 2014 22:21:12 +0000 (00:21 +0200)]
BUG-509: remove HashMapDataStore

The HashMapDataStore is not something we want to ship in Helium -- it
is utterly obsolete and defunct. So just remove it.

Change-Id: I62977f0f897752a388673f977222c79ff55062f0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1933: consult state in subtree modified path"
Tony Tkacik [Wed, 17 Sep 2014 14:08:58 +0000 (14:08 +0000)]
Merge "BUG-1933: consult state in subtree modified path"

9 years agoBUG-1933: consult state in subtree modified path
Robert Varga [Wed, 17 Sep 2014 09:34:57 +0000 (11:34 +0200)]
BUG-1933: consult state in subtree modified path

resolveSubtreeChangeEvent() was missing a state.needsProcessing() check,
which means change resolution continued down that path eventhough no
listeners were subscribed to it. Add the check and return with a true if
we terminate early.

Change-Id: I7d386f3abd67c1a241ad88b5809236598dc967dd
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 1904: Handle null ThreadExecutorStatsMXBeanImpl in ShardStats"
Moiz Raja [Tue, 16 Sep 2014 15:29:29 +0000 (15:29 +0000)]
Merge "Bug 1904: Handle null ThreadExecutorStatsMXBeanImpl in ShardStats"

9 years agoBUG-650: use SameThreadExecutor for commits
Robert Varga [Sun, 14 Sep 2014 22:06:54 +0000 (00:06 +0200)]
BUG-650: use SameThreadExecutor for commits

Profiling has shown that the cost of performing a forced context switch
in execution path of the data store leads to ~2x performance
degradation (23600 vs. 40000 ops/s), with average of 20 runs:

InMemoryDataStoreWithExecutorServiceBenchmark:                     total      stddev
write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark    4227.384 ms   61.172
write100KSingleNodeWithOneInnerItemInOneCommitBenchmark          286.954 ms   14.350
write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark     364.004 ms   12.687
write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark           17.936 ms    0.883
write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark    1979.140 ms   56.529
write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark          136.749 ms    6.402

InMemoryDataStoreWithSameThreadedExecutorBenchmark:                total      stddev
write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark    2475.137 ms  220.396
write100KSingleNodeWithOneInnerItemInOneCommitBenchmark          267.298 ms    7.063
write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark     180.537 ms    1.337
write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark           19.582 ms    0.200
write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark    1127.771 ms   87.438
write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark          134.401 ms    2.110

The analysis is that the underlying component (yang-data-impl's
DataTree) can process operations at a rate exceeding 30K ops/s,
obviously depending on size, which means a transaction is completed
every ~35 microseconds. When we factor in the fact that there is at most
one transaction issued at a particular moment (due to ordering/conflict
resolution), the ill effects of forced context switches become very much
pronounced.

This patch switches the executor service to SameThreadExecutor, which
foregoes queueing and executes the task on the submitting thread (which
is the datastore coordinator thread, not some user thread).

The option to switch the executor service is left intact, but may be
removed in future pending further benchmarks.

Change-Id: Ic1c4c0b1b80aa77c2d85810736bdc370a465eee8
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: allow executor stats to work with other executors
Robert Varga [Sun, 14 Sep 2014 22:04:41 +0000 (00:04 +0200)]
BUG-650: allow executor stats to work with other executors

Instead of requiring a threadpool-backed executor, we make the
constructor private and introduce a static factory method.

Change-Id: I904b90a16d3664341e32cb0d982299fca3205f0d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: use an EnumMap for datastore map
Robert Varga [Sun, 14 Sep 2014 23:23:21 +0000 (01:23 +0200)]
BUG-650: use an EnumMap for datastore map

EnumMap has better performance characteristics than immutable map -- so
let's use it.

Change-Id: Ib15be015f38841469bccee8c8a1f19266897a5de
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-865: TransactionCommitDeadlockException safety
Robert Varga [Sun, 14 Sep 2014 22:03:04 +0000 (00:03 +0200)]
BUG-865: TransactionCommitDeadlockException safety

This patch fixes safety (public non-constant field) and improves
performance by using a shared RpcError instances. Also moves over to use
a Supplier instead of a Function.

Change-Id: Id9d269fe9be6dacea3c216d4ad76efa79bdb27f0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-650: clarify TransactionFactory close state handling"
Tony Tkacik [Sun, 14 Sep 2014 15:00:50 +0000 (15:00 +0000)]
Merge "BUG-650: clarify TransactionFactory close state handling"

9 years agoBUG-650: clarify TransactionFactory close state handling
Robert Varga [Fri, 12 Sep 2014 21:45:02 +0000 (23:45 +0200)]
BUG-650: clarify TransactionFactory close state handling

getAndSet() translates to a get() + compareAndSet(). We already know the
expected value, so we can skip the first bit. The nice thing is that CAS
will readily give us a boolean, so the code becomes a bit more clear,
too.

Change-Id: Id77dcefb7ba85512fcebbcae7f43f08cd8094fbc
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge changes I9b32ab30,Iebe4701f
Tony Tkacik [Sat, 13 Sep 2014 12:46:44 +0000 (12:46 +0000)]
Merge changes I9b32ab30,Iebe4701f

* changes:
  BUG-650: speed CommitCoordinationTask up
  BUG-650: improve transaction chaining performance

9 years agoBUG-650: SnapshotBackedWriteTransaction performance
Robert Varga [Fri, 12 Sep 2014 16:59:24 +0000 (18:59 +0200)]
BUG-650: SnapshotBackedWriteTransaction performance

Remove synchronized block from ready() and cleanup exposed interfaces,
adding some task which need to be fixed still.

Change-Id: Ib1c25819eca60d393a742ab3ebfec6083fe9745d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: speed CommitCoordinationTask up
Robert Varga [Fri, 12 Sep 2014 20:47:52 +0000 (22:47 +0200)]
BUG-650: speed CommitCoordinationTask up

Eliminates synchronized block in favor of a compare-and-swap -- the
logic was doing precisely that anyway.

Change-Id: I9b32ab303eb718e8a0af52526857eead65c2b697
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: speedup DOMDataBrokerTransactionChainImpl
Robert Varga [Fri, 12 Sep 2014 13:29:09 +0000 (15:29 +0200)]
BUG-650: speedup DOMDataBrokerTransactionChainImpl

The transaction chain implementation does not need to have
synchronization on submit, but rather it needs to check if the chain has
not been closed (implictly or explicitly). Same goes for the close path,
thus this patch speeds things up by downgrading the synchronized
sections to volatile reads and writes.

Change-Id: I57dec6dbfb1933005a9ee0718b666ee102ce7116
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: improve transaction chaining performance
Robert Varga [Fri, 12 Sep 2014 18:21:53 +0000 (20:21 +0200)]
BUG-650: improve transaction chaining performance

Transaction chaining has mucked inside SnapshotBackedWriteTransaction to
get its state everytime a new transaction was allocated. Instead we
expose proper lifecycle hooks, so the chain handling logic can keep
track of state itself.

As an added feature, this fixes a bug, where a chain would become
unusable if the user closed a write transaction without actually calling
ready() on it.

Finally it fixes a synchronization bug, where a commit task would not be
properly synchronized with listener registrations.

Change-Id: Iebe4701f1712a95a9316ea8380fe12c8c5fe6b89
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: optimize DOMDataBrokerImpl chain creation
Robert Varga [Fri, 12 Sep 2014 12:54:29 +0000 (14:54 +0200)]
BUG-650: optimize DOMDataBrokerImpl chain creation

An EnumMap is better than an immutable map when accessing via the
enumeration value. Also add a check for closed factory.

Change-Id: I208005a2b13c0a16cb594da7c74556f4e9a54e50
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: speedup AbstractDOMForwardedTransactionFactory
Robert Varga [Fri, 12 Sep 2014 12:41:29 +0000 (14:41 +0200)]
BUG-650: speedup AbstractDOMForwardedTransactionFactory

Another speedup -- as it turns out we do not have to take the full lock
to close down the transaction factory. A volatile write is enough to do
that -- which means a volatile read is enough to check for it having
been closed.

Change-Id: I3488ccccc4d91d34665b3ff6e70e047407be48bb
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: AbstractDOMForwardedTransactionFactory
Robert Varga [Fri, 12 Sep 2014 12:31:49 +0000 (14:31 +0200)]
BUG-650: AbstractDOMForwardedTransactionFactory

ImmutableMap is not really what we want to track datastores -- EnumMap
has constant time lookups for everything, plus its use eliminates a
needless builder object allocation.

Change-Id: I0bea628b82d8366bf14532d3bc321067584a84b5
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-650: speedup getSubtransaction()"
Tony Tkacik [Fri, 12 Sep 2014 15:31:24 +0000 (15:31 +0000)]
Merge "BUG-650: speedup getSubtransaction()"

9 years agoMerge "BUG-650: optimize DOMForwardedWriteTransaction"
Tony Tkacik [Fri, 12 Sep 2014 14:12:04 +0000 (14:12 +0000)]
Merge "BUG-650: optimize DOMForwardedWriteTransaction"

9 years agoMerge "BUG-650: cache translated future"
Tony Tkacik [Fri, 12 Sep 2014 14:11:09 +0000 (14:11 +0000)]
Merge "BUG-650: cache translated future"

9 years agoBUG-650: speedup getSubtransaction()
Robert Varga [Fri, 12 Sep 2014 11:20:37 +0000 (13:20 +0200)]
BUG-650: speedup getSubtransaction()

getSubtransaction() is on fast path and it performs two map lookups:
first with containsKey() and then with get(). We know the map cannot
contain null values, so we can perform only the get() and then make
a precondition check on the returned value being non-null.

Change-Id: I477969c8512e3c22e5b7ae5455e0281613a9c752
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: optimize DOMForwardedWriteTransaction
Robert Varga [Fri, 12 Sep 2014 10:05:14 +0000 (12:05 +0200)]
BUG-650: optimize DOMForwardedWriteTransaction

First make sure we get visiblity into cohorts as a collections. This
allows us to optimize allocation of the list where we hold the futures.
We also make it non-immutable -- it is handed off, so there is no reason
to pay the price of an additional allocation.

Second we optimize the transaction state checking by eliminating as
many volatile read/writes as possible. The bottom line is the following:

1) the put/merge/delete paths see only a single volatile read instead of
   two
2) the submit path performs only one volatile get+set and an ordered
   write -- instead of two reads and two writes
3) the cancel path performs a volatile get+set and either an ordered
   write (fast path) or a spin on volatile read (slow path) -- instead of
   a synchronized block, four volatile reads and two volatile writes

Change-Id: I5ec875e65acdee62a4f0daf233617e6af024637f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: cache translated future
Robert Varga [Fri, 12 Sep 2014 09:42:10 +0000 (11:42 +0200)]
BUG-650: cache translated future

We are instantiating a done future with fixed result -- this is an
invariant, which can readily be shared. do precisely that by retaining a
single global instance.

Change-Id: I0a24adf6f3df4794fda5148c04baed7bbde11c64
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 650: Removed uncessary wrapping and allocation of futures"
Tony Tkacik [Fri, 12 Sep 2014 07:58:31 +0000 (07:58 +0000)]
Merge "Bug 650: Removed uncessary wrapping and allocation of futures"

9 years agoBug 650: Removed uncessary wrapping and allocation of futures
Robert Varga [Thu, 11 Sep 2014 11:58:32 +0000 (13:58 +0200)]
Bug 650: Removed uncessary wrapping and allocation of futures

There is no need to use an intermediate checkfuture just to communicate
the list over, so let's get rid of the warpping. At the same time we
eliminate lists and opt for arrays. The sizing requirements for arrays
are determined precisely once, when a coordinator is allocated.

Change-Id: Id5c4c7852210b99c4da3e9e77a84c0d2d0fa622d
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Fixed test which tested incorrect string formating"
Tom Pantelis [Thu, 11 Sep 2014 16:16:12 +0000 (16:16 +0000)]
Merge "Fixed test which tested incorrect string formating"

9 years agoFixed test which tested incorrect string formating
Tony Tkacik [Thu, 11 Sep 2014 14:45:53 +0000 (16:45 +0200)]
Fixed test which tested incorrect string formating

It turned out, that this test suite tested returned
formated string from YANGTools, which format was not
part of API Contract.

Updated test to test to only for non nulls, which
are parts of API Contract.

Change-Id: I6e33993928667c6e8b4a830b6d0a9c8d10cd4fa2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 1763: Fixed illegal state in Binding Transaction Chain.
Tony Tkacik [Tue, 9 Sep 2014 07:28:33 +0000 (09:28 +0200)]
Bug 1763: Fixed illegal state in Binding Transaction Chain.

Naming in BindingTransactionChain, which operates
with user supplied Binding Transaction Chain listener
and chain's own DOM TransactionChain led to invalid
substition of this two, which caused IllegalStateException
when chain failed.

Change-Id: I2a40cd2c200f0b9b7149908f05d84685891c71ea
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-650: allocation-free ResolveDataChangeState.needsProcessing()"
Tony Tkacik [Tue, 9 Sep 2014 07:15:44 +0000 (07:15 +0000)]
Merge "BUG-650: allocation-free ResolveDataChangeState.needsProcessing()"

9 years agoMerge "BUG-650: optimize subtree listener collection"
Tony Tkacik [Tue, 9 Sep 2014 07:14:48 +0000 (07:14 +0000)]
Merge "BUG-650: optimize subtree listener collection"

9 years agoMerge "BUG-650: squash maps to Collections.emptyMap()"
Tony Tkacik [Tue, 9 Sep 2014 07:14:03 +0000 (07:14 +0000)]
Merge "BUG-650: squash maps to Collections.emptyMap()"

9 years agoMerge "BUG-650: ResolveDataChangeState.inheritedOne should be a Collection"
Tony Tkacik [Tue, 9 Sep 2014 07:13:36 +0000 (07:13 +0000)]
Merge "BUG-650: ResolveDataChangeState.inheritedOne should be a Collection"

9 years agoMerge "BUG-650: speed up ResolveDataChangeState.needsProcessing()"
Tony Tkacik [Tue, 9 Sep 2014 07:12:46 +0000 (07:12 +0000)]
Merge "BUG-650: speed up ResolveDataChangeState.needsProcessing()"

9 years agoBUG-650: allocation-free ResolveDataChangeState.needsProcessing()
Robert Varga [Mon, 8 Sep 2014 18:46:32 +0000 (20:46 +0200)]
BUG-650: allocation-free ResolveDataChangeState.needsProcessing()

Critical path optimization. Based on logic introduced in previous
patches, we now know that when the inherited subtree listener iterable
is not a Collection, it is by definition non-empty. Use this knowledge
to elide Iterables.isEmpty() which is (relatively) costly due to
object allocation.

With this patch, ResolveDataChangeState.needsProcessing() does not
allocate any objects and relies on readily-available state to determine
whether additional processing is required.

Change-Id: I0322e0a8f58165f695f2284116057d03e2d4cb45
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: optimize subtree listener collection
Robert Varga [Mon, 8 Sep 2014 18:29:16 +0000 (20:29 +0200)]
BUG-650: optimize subtree listener collection

This further optimizes passing of subtree listeners by retaining the
first collection of subtree listeners rather than immediately skipping
to interable concatenation.

Change-Id: I08fd63b092043ef814a47daba67744042d5c29be
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: squash maps to Collections.emptyMap()
Robert Varga [Mon, 8 Sep 2014 17:11:54 +0000 (19:11 +0200)]
BUG-650: squash maps to Collections.emptyMap()

If possible, we do not retain mutable maps, but rather short-cut to
emptyMap(). This should help us a bit when traversing empty elements.

Change-Id: Iff7eccfcc99c451d11f87cf466c7f09bde63ee10
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: ResolveDataChangeState.inheritedOne should be a Collection
Robert Varga [Mon, 8 Sep 2014 17:20:56 +0000 (19:20 +0200)]
BUG-650: ResolveDataChangeState.inheritedOne should be a Collection

There is no need to demote this to Iterable just to then use
Iterables.isEmpty(), as we are always initializing it with a collection,
which has a quick isEmpty() method. Also promote its order before
interitedSub, so the slow path can be faster a bit.

Change-Id: Ic536e2420cfae98941ec638510c98ec3a8230c09
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: speed up ResolveDataChangeState.needsProcessing()
Robert Varga [Mon, 8 Sep 2014 16:32:39 +0000 (18:32 +0200)]
BUG-650: speed up ResolveDataChangeState.needsProcessing()

Checking for empty subBuilders allows us to reuse the parent's
collection. For simple cases with no listeners whis speeds up
needsProcessing() by completely reusing the emptyList and for
non-trivial cases it just omits object instantiation.

Change-Id: Ib3089bca2ec4f7e1ef826bf4192b8154ff154702
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 1703: Added debug logging of ignored event to ease debuging."
Ed Warnicke [Mon, 8 Sep 2014 15:08:23 +0000 (15:08 +0000)]
Merge "Bug 1703: Added debug logging of ignored event to ease debuging."

9 years agoBUG-997: migrate the global context schema service
Robert Varga [Thu, 31 Jul 2014 15:47:47 +0000 (17:47 +0200)]
BUG-997: migrate the global context schema service

This change test-drives the new re-implementation, making sure we have a
user. An immediate advantage should be faster context convergence times.
Requires I3311a3f0251868f91c385d0291365934ccfb9ede in yangtools.

Change-Id: Ic2f07144043f456ab9821013c1d690904c9a791f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1703: Added debug logging of ignored event to ease debuging.
Tony Tkacik [Fri, 5 Sep 2014 07:08:48 +0000 (09:08 +0200)]
Bug 1703: Added debug logging of ignored event to ease debuging.

Change-Id: Ic7bcbc249bb35018561d28d757dadca8509b933c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-1690: catch wildcard InstanceIdentifiers"
Tony Tkacik [Fri, 5 Sep 2014 07:10:12 +0000 (07:10 +0000)]
Merge "BUG-1690: catch wildcard InstanceIdentifiers"

9 years agoMerge "Prefer InstanceIdentifier imports"
Tony Tkacik [Fri, 5 Sep 2014 07:09:52 +0000 (07:09 +0000)]
Merge "Prefer InstanceIdentifier imports"

9 years agoMerge "BUG-1679: optinally log allocation context"
Tony Tkacik [Fri, 5 Sep 2014 07:09:35 +0000 (07:09 +0000)]
Merge "BUG-1679: optinally log allocation context"

9 years agoBUG-1679: optinally log allocation context
Robert Varga [Wed, 3 Sep 2014 16:19:52 +0000 (18:19 +0200)]
BUG-1679: optinally log allocation context

Transactions can now print their allocation context.

Change-Id: I801a44d1270f8becd2835cc31b514e2e0fdaee33
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1690: catch wildcard InstanceIdentifiers
Robert Varga [Thu, 4 Sep 2014 12:19:01 +0000 (14:19 +0200)]
BUG-1690: catch wildcard InstanceIdentifiers

Read/write/merge/delete of wildcarded instance identifiers is not
defined, so catch them early on in the binding broker implementation.

Change-Id: I97161f88b8496a78575d6a7bc1b7bab8fee1da5b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoPrefer InstanceIdentifier imports
Robert Varga [Thu, 4 Sep 2014 10:26:44 +0000 (12:26 +0200)]
Prefer InstanceIdentifier imports

InstanceIdentifier/YangInstanceIdentifier are now separate, so we can
import them at the same time. Do precisely that.

Change-Id: I54a5cd49ef7b8584a5b09a12ab97e132fb92cb57
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge changes I9aa41251,Ibd0fb687
Ed Warnicke [Thu, 4 Sep 2014 17:01:41 +0000 (17:01 +0000)]
Merge changes I9aa41251,Ibd0fb687

* changes:
  Bug 1703: Fixed memory leak in TransactionChain
  Bug 222: Added basic Restconf operational statistics

9 years agoBug 1703: Fixed memory leak in TransactionChain
Tony Tkacik [Thu, 4 Sep 2014 14:18:46 +0000 (16:18 +0200)]
Bug 1703: Fixed memory leak in TransactionChain

As it turned out WeakHashMap is not cleared
if value has strong reference to key. This
required to rewrite BindingTransactionChain
to listen on submit futures for each  transaction
in order to receive events mapped to binding transaction.

This actually simplifies code and removes
any need for having canonical mapping from
DOM transaction to Binding transaction.

Change-Id: I9aa4125197b022dd163f85c6965ad1227e771b99
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Be sure to shutdown instance when destroyed"
Tony Tkacik [Thu, 4 Sep 2014 12:49:58 +0000 (12:49 +0000)]
Merge "Be sure to shutdown instance when destroyed"

9 years agoMerge "Bug 1446: Add JMX stats for in-memory data store"
Ed Warnicke [Wed, 3 Sep 2014 22:51:08 +0000 (22:51 +0000)]
Merge "Bug 1446: Add JMX stats for in-memory data store"

9 years agoMerge "Datastore: Reuse successful future"
Tony Tkacik [Wed, 3 Sep 2014 16:10:37 +0000 (16:10 +0000)]
Merge "Datastore: Reuse successful future"

9 years agoMerge "Datastore: lower in-memory change tracking overhead"
Tony Tkacik [Wed, 3 Sep 2014 16:10:11 +0000 (16:10 +0000)]
Merge "Datastore: lower in-memory change tracking overhead"

9 years agoDatastore: Reuse successful future
Robert Varga [Tue, 2 Sep 2014 09:25:51 +0000 (11:25 +0200)]
Datastore: Reuse successful future

ImmediateFuture does not keep any state, so we can reuse a single
instance, preventing garbage buildup just a tiny bit.

Change-Id: I200662a666f4529ea82a2ac3948be9536ca32281
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDatastore: lower in-memory change tracking overhead
Robert Varga [Mon, 1 Sep 2014 22:09:09 +0000 (00:09 +0200)]
Datastore: lower in-memory change tracking overhead

We needlessly track the reference to notification manager inside the
even tasks. Instead simplify the return to a Map.Entry and pipe the
resulted data into the manager. This reduces the temporary size of a
tracker, lowering the rate at which we produce garbage.

Change-Id: Ib390d0e65ce1583371a2e887525d9b7ee0392396
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-868: migrate ClassLoaderUtils user"
Tony Tkacik [Tue, 2 Sep 2014 05:42:15 +0000 (05:42 +0000)]
Merge "BUG-868: migrate ClassLoaderUtils user"

9 years agoBUG-868: migrate ClassLoaderUtils user
Robert Varga [Wed, 6 Aug 2014 21:30:34 +0000 (23:30 +0200)]
BUG-868: migrate ClassLoaderUtils user

Moves to yangtools.util, which is not deprecated.

Change-Id: Ibb69c68e027c4732d8967f44c869bf00797a1785
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1904: Handle null ThreadExecutorStatsMXBeanImpl in ShardStats
tpantelis [Mon, 1 Sep 2014 17:31:18 +0000 (13:31 -0400)]
Bug 1904: Handle null ThreadExecutorStatsMXBeanImpl in ShardStats

Change-Id: I4b2845a6174986dc24ea6e4e670c78906d8a6ebe
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoMerge "Bug 1636: Fixed invalid model of inmemory-datastore configuration."
Ed Warnicke [Fri, 29 Aug 2014 01:30:48 +0000 (01:30 +0000)]
Merge "Bug 1636: Fixed invalid model of inmemory-datastore configuration."

9 years agoBug 1636: Fixed invalid model of inmemory-datastore configuration.
Tony Tkacik [Thu, 28 Aug 2014 13:12:54 +0000 (15:12 +0200)]
Bug 1636: Fixed invalid model of inmemory-datastore configuration.

Change-Id: I280cd4478d1dd5ab65e333658e802394693272bb
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Cleanup DOMStoreReadTransaction/DOMDataReadTransaction exists API documentation"
Tom Pantelis [Wed, 27 Aug 2014 15:07:32 +0000 (15:07 +0000)]
Merge "Cleanup DOMStoreReadTransaction/DOMDataReadTransaction exists API documentation"

9 years agoMerge "BUG-1493: activate recursion elision"
Tony Tkacik [Wed, 27 Aug 2014 14:16:09 +0000 (14:16 +0000)]
Merge "BUG-1493: activate recursion elision"

9 years agoCleanup DOMStoreReadTransaction/DOMDataReadTransaction exists API documentation
Moiz Raja [Wed, 13 Aug 2014 23:24:36 +0000 (16:24 -0700)]
Cleanup DOMStoreReadTransaction/DOMDataReadTransaction exists API documentation

This commit also cleans up the usage of ForwardedBackwardsCompatibleDataBroker from DataBrokerTestCustomizer

Change-Id: Icfb078eb54f7dae6c436ff41e7c1657b0cf4175f
Signed-off-by: Moiz Raja <moraja@cisco.com>
9 years agoMerge "BUG-650: fromYangInstanceIdentifier() can return null"
Tony Tkacik [Wed, 27 Aug 2014 09:47:11 +0000 (09:47 +0000)]
Merge "BUG-650: fromYangInstanceIdentifier() can return null"

9 years agoBUG-650: fromYangInstanceIdentifier() can return null
Robert Varga [Tue, 26 Aug 2014 19:49:33 +0000 (21:49 +0200)]
BUG-650: fromYangInstanceIdentifier() can return null

Properly interpret a null return as an absent identifier.

Clarified cast in #toBinding(Entry) and explained
why it is necessary, even if Eclipse reports
it as unnecessary (difference in various java compilers).

Change-Id: I2dd7cd631cb958a28ddce8db62d20e0292ae8a39
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Simplify YangInstanceIdentifier references"
Tony Tkacik [Wed, 27 Aug 2014 08:05:27 +0000 (08:05 +0000)]
Merge "Simplify YangInstanceIdentifier references"

9 years agoBug 1446: Add JMX stats for in-memory data store
tpantelis [Sat, 23 Aug 2014 21:42:55 +0000 (17:42 -0400)]
Bug 1446: Add JMX stats for in-memory data store

    Added stats, available via JMX,  to track data for the various thread
    pool executors used by the in-memory data store. Also added commit stats.

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