Tom,

I think it depends on the use case for which user is using cohort. For
example If user have a use case where it sends very few rest request to the
controller from northbound side but want to make sure it runs all the
possible checks against that data to make sure that it can avoid any wrong
configuration (according to the use case and not really as per yang
schema). In general i agree with you that anything that takes more then 5
second, it's better to probably write that logic in the application rather
than in the cohort, but we don't know all the use cases people use it for.
So i think having a config knob (with default value to 5 second or lower)
will give user an option to change it (increase or decrease) as per their
usecase.

On Tue, May 16, 2017 at 3:19 AM, Tom Pantelis <tompante...@gmail.com> wrote:

> yes - it is currently hard-coded to 5 sec. It was not intended for cohorts
> to take 5-20 sec to validate. Cohorts are supposed to be performant as the
> API javadocs stress, especially since they're currently invoked
> synchronously and thus block the Shard.
>
> On Mon, May 15, 2017 at 10:20 PM, Anil Vishnoi <vishnoia...@gmail.com>
> wrote:
>
>> I believe this is where it is set
>>
>> https://github.com/opendaylight/controller/blob/master/
>> opendaylight/md-sal/sal-distributed-datastore/src/main
>> /java/org/opendaylight/controller/cluster/datastore/ShardDat
>> aTree.java#L106
>>
>> Not sure if there is any way to configure it though any akka/cluster
>> config knob.
>>
>> On Mon, May 15, 2017 at 8:23 AM, Michael Vorburger <vorbur...@redhat.com>
>> wrote:
>>
>>> On Mon, May 15, 2017 at 5:06 PM, Satish Dutt <sd...@advaoptical.com>
>>> wrote:
>>>
>>>> Hi Michael,
>>>>
>>>>
>>>>
>>>> Thanks for your response. I am writing a custom cohort class for some
>>>> validation purpose, which extends the DOMDataTreeCommitCohort of the
>>>> mdsal.dom.api package and overrides the canCommit(). canCommit() in my
>>>> cohort does some validations and just return a Future object indicating
>>>> success or failure. I am NOT actually timing out the Future . Sometimes my
>>>> cohort class takes more than 5 seconds to execute and the MDSAL commit
>>>> times-out.
>>>>
>>>
>>> Oh you didn't specify that in your first email... sorry, I don't know
>>> anything more about this; maybe others will chime in.
>>>
>>>
>>>> I  suspect  that some classes in MDSAL are probably timing out the
>>>> commit, since it is exceeding the default timeout value of 5 seconds. But
>>>> in my application, I can wait for more than 5 seconds possibly around 20
>>>> seconds for doing the validation. For this I want to know the code of the
>>>> MDSAL which I can tweak for setting a higher timeout value and use that
>>>> code locally in my application.
>>>>
>>>>
>>>>
>>>>   "errors": {
>>>>
>>>>     "error": [
>>>>
>>>>       {
>>>>
>>>>         "error-type": "application",
>>>>
>>>>         "error-tag": "operation-failed",
>>>>
>>>>         "error-message": "canCommit encountered an unexpected failure",
>>>>
>>>>         "error-info": "java.util.concurrent.TimeoutException: Futures
>>>> timed out after [5 seconds]\n\tat scala.concurrent.impl.Promise$
>>>> DefaultPromise.ready(Promise.scala:219)\n\tat
>>>> scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223)\n\tat
>>>> scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190)\n\tat
>>>> akka.dispatch.MonitorableThreadFactory$AkkaForkJoinWorkerThr
>>>> ead$$anon$3.block(ThreadPoolBuilder.scala:167)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinPool.managedBlock(ForkJoinPool.java:3640)\n\tat
>>>> akka.dispatch.MonitorableThreadFactory$AkkaForkJoinWorkerThr
>>>> ead.blockOn(ThreadPoolBuilder.scala:165)\n\tat
>>>> scala.concurrent.Await$.result(package.scala:190)\n\tat
>>>> scala.concurrent.Await.result(package.scala)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.CompositeDataT
>>>> reeCohort.processResponses(CompositeDataTreeCohort.java:162)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.CompositeDataT
>>>> reeCohort.canCommit(CompositeDataTreeCohort.java:122)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.SimpleShardDat
>>>> aTreeCohort.userPreCommit(SimpleShardDataTreeCohort.java:162)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.ShardDataTree.
>>>> startPreCommit(ShardDataTree.java:584)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.SimpleShardDat
>>>> aTreeCohort.preCommit(SimpleShardDataTreeCohort.java:91)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.CohortEntry.pr
>>>> eCommit(CohortEntry.java:102)\n\tat org.opendaylight.controller.cl
>>>> uster.datastore.ShardCommitCoordinator.doCommit(ShardCommitCoordinator.java:296)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.ShardCommitCoo
>>>> rdinator.access$200(ShardCommitCoordinator.java:49)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.ShardCommitCoo
>>>> rdinator$2.onSuccess(ShardCommitCoordinator.java:243)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.ShardCommitCoo
>>>> rdinator$2.onSuccess(ShardCommitCoordinator.java:237)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.SimpleShardDat
>>>> aTreeCohort.successfulCanCommit(SimpleShardDataTreeCohort.java:145)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.ShardDataTree.
>>>> processNextTransaction(ShardDataTree.java:526)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.ShardDataTree.
>>>> startCanCommit(ShardDataTree.java:560)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.SimpleShardDat
>>>> aTreeCohort.canCommit(SimpleShardDataTreeCohort.java:81)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.CohortEntry.ca
>>>> nCommit(CohortEntry.java:98)\n\tat org.opendaylight.controller.cl
>>>> uster.datastore.ShardCommitCoordinator.handleCanCommit(Shard
>>>> CommitCoordinator.java:237)\n\tat org.opendaylight.controller.cl
>>>> uster.datastore.ShardCommitCoordinator.handleReadyLocalTrans
>>>> action(ShardCommitCoordinator.java:201)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.Shard.handleRe
>>>> adyLocalTransaction(Shard.java:437)\n\tat
>>>> org.opendaylight.controller.cluster.datastore.Shard.handleNo
>>>> nRaftCommand(Shard.java:243)\n\tat org.opendaylight.controller.cl
>>>> uster.raft.RaftActor.handleCommand(RaftActor.java:291)\n\tat
>>>> org.opendaylight.controller.cluster.common.actor.AbstractUnt
>>>> ypedPersistentActor.onReceiveCommand(AbstractUntypedPersistentActor.java:29)\n\tat
>>>> akka.persistence.UntypedPersistentActor.onReceive(PersistentActor.scala:170)\n\tat
>>>> org.opendaylight.controller.cluster.common.actor.MeteringBeh
>>>> avior.apply(MeteringBehavior.java:97)\n\tat
>>>> akka.actor.ActorCell$$anonfun$become$1.applyOrElse(ActorCell.scala:544)\n\tat
>>>> akka.actor.Actor$class.aroundReceive(Actor.scala:484)\n\tat
>>>> akka.persistence.UntypedPersistentActor.akka$persistence$Eve
>>>> ntsourced$$super$aroundReceive(PersistentActor.scala:168)\n\tat
>>>> akka.persistence.Eventsourced$$anon$1.stateReceive(Eventsourced.scala:633)\n\tat
>>>> akka.persistence.Eventsourced$class.aroundReceive(Eventsourced.scala:179)\n\tat
>>>> akka.persistence.UntypedPersistentActor.aroundReceive(PersistentActor.scala:168)\n\tat
>>>> akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)\n\tat
>>>> akka.actor.ActorCell.invoke(ActorCell.scala:495)\n\tat
>>>> akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)\n\tat
>>>> akka.dispatch.Mailbox.run(Mailbox.scala:224)\n\tat
>>>> akka.dispatch.Mailbox.exec(Mailbox.scala:234)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinW
>>>> orkerThread.java:107)\n"
>>>>
>>>>       }
>>>>
>>>>     ]
>>>>
>>>>   }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> Regards
>>>>
>>>> -Satish
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *From:* Michael Vorburger [mailto:vorbur...@redhat.com]
>>>> *Sent:* Monday, May 15, 2017 8:10 PM
>>>> *To:* Satish Dutt <sd...@advaoptical.com>
>>>> *Cc:* mdsal-...@lists.opendaylight.org; controller-dev@lists.opendayli
>>>> ght.org
>>>> *Subject:* Re: [mdsal-dev] How to increase the timeout value for a
>>>> commit operation to the data store ?
>>>>
>>>>
>>>>
>>>> Satish,
>>>>
>>>>
>>>>
>>>> On Mon, May 15, 2017 at 2:26 PM, Satish Dutt <sd...@advaoptical.com>
>>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>>
>>>>
>>>> Is there any way to increase the timeout value for a commit operation
>>>> to the datastore ? Sometimes I get timeout value during the commit 
>>>> operation
>>>>
>>>>
>>>>
>>>> AFAIK, the 5s timeout you're experience below from a commit to the
>>>> datastore is probably not coming from mdsal (controller) code itself, but
>>>> from something using it .. if I were you I would look more at the code
>>>> doing the commit - it receives a Future in return, and some code in your
>>>> application is probably timing out on that Future - could that be?hh
>>>>
>>>>
>>>> Tx,
>>>>
>>>> M.
>>>>
>>>> --
>>>>
>>>> Michael Vorburger, Red Hat
>>>> vorbur...@redhat.com | IRC: vorburger @freenode | ~ =
>>>> http://vorburger.ch
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> {
>>>>
>>>>   "errors": {
>>>>
>>>>     "error": [
>>>>
>>>>       {
>>>>
>>>>         "error-type": "application",
>>>>
>>>>         "error-tag": "operation-failed",
>>>>
>>>>         "error-message": "canCommit encountered an unexpected failure",
>>>>
>>>>         "error-info": "java.util.concurrent.TimeoutException: Futures
>>>> timed out after [5 seconds]\n\tat
>>>>
>>>>                                 scala.concurrent.impl.Promise$
>>>> DefaultPromise.ready(Promise.scala:219)\n\tat
>>>>
>>>>          …
>>>>
>>>>          …
>>>>
>>>>          …
>>>>
>>>>                                 
>>>> akka.dispatch.Mailbox.exec(Mailbox.scala:234)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)\n\tat
>>>>
>>>>
>>>>                                 scala.concurrent.forkjoin.Fork
>>>> JoinPool.runWorker(ForkJoinPool.java:1979)\n\tat
>>>> scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinW
>>>> orkerThread.java:107)\n"
>>>>
>>>>       }
>>>>
>>>>     ]
>>>>
>>>>   }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> Regards
>>>>
>>>> -Satish
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> mdsal-dev mailing list
>>>> mdsal-...@lists.opendaylight.org
>>>> https://lists.opendaylight.org/mailman/listinfo/mdsal-dev
>>>>
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> controller-dev mailing list
>>> controller-dev@lists.opendaylight.org
>>> https://lists.opendaylight.org/mailman/listinfo/controller-dev
>>>
>>>
>>
>>
>> --
>> Thanks
>> Anil
>>
>> _______________________________________________
>> mdsal-dev mailing list
>> mdsal-...@lists.opendaylight.org
>> https://lists.opendaylight.org/mailman/listinfo/mdsal-dev
>>
>>
>


-- 
Thanks
Anil
_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to