[MDSAL-41] Provide support for custom Commit Cohorts Created: 27/Jul/14  Updated: 09/Mar/18  Resolved: 10/Feb/17

Status: Resolved
Project: mdsal
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Reinaldo Penno Assignee: Tony Tkacik
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: PC


Issue Links:
Blocks
is blocked by CONTROLLER-1233 Implement proxy and expose Binding Da... Resolved
Duplicate
is duplicated by CONTROLLER-662 Datastore: expose AsyncConfigurationC... Resolved
External issue ID: 1435

 Description   

https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:EverythingYouWantedtoKNowaboutOnDataChanged_butWasAfraidToAsk#Data_Commit_Handler_Issues

I looked at 1209 and if new API provides fixes problems, please point to concrete example on how to overcome problems described in wiki.



 Comments   
Comment by Tony Tkacik [ 28/Jul/14 ]

Please

Comment by Tony Tkacik [ 28/Jul/14 ]

(In reply to Tony Tkacik from comment #1)
> Please

Accidentally submitted unfinished answer,

Please could you insert body from wiki here, to track it in one place
outside of wiki (since wiki is free for all).

Comment by Reinaldo Penno [ 28/Jul/14 ]

1- Commit Handler is called for every commit independent of attachment point. If I attach a Commit Handler to a Yang List in a specific model, I expect it to be called only for transaction at that level or lower, but it is called for every controller config transaction.
2 - Even though I return a failed transaction from callback handler, data is still pushed to the datastore. Basically a RESTconf PUT request triggers the callback which returns "RpcResultBuilder.<Void> failed().build()" (I also tried returning null), but data is not rolled back. This does not agree with documentation and defeats the core value of this construct.

https://jenkins.opendaylight.org/controller/job/controller-merge/lastSuccessfulBuild/artifact/target/apidocs/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandler.html

"If error occured, the broker starts a commit rollback phase. "

If I change the code below to honor a failed RpcResult from Provider, the transaction still goes through. It seems there is no stopping RESTconf from failing a transaction

return Futures.transform(dataStoreCommit, new Function<RpcResult<TransactionStatus>,RpcResult<TransactionStatus>>() {
@Override
public RpcResult<TransactionStatus> apply(final RpcResult<TransactionStatus> input) {
if(input.isSuccessful()) {
for(DataCommitTransaction<InstanceIdentifier<? extends DataObject>, DataObject> subTx : subTrans ) {
if (!subTx.finish().isSuccessful()) { //<=== Changed Code
LOG.error("Provider {} commit failed.", subTx.toString());
RpcResult<TransactionStatus> rpcResult = RpcResultBuilder.<TransactionStatus>failed().build();
return rpcResult;
}
}
} else {
LOG.error("Tx: {} Rollback - Datastore commit failed.",tx.getIdentifier());
for(DataCommitTransaction<InstanceIdentifier<? extends DataObject>, DataObject> subTx : subTrans )

{ subTx.rollback(); }

}
return input;
}
});

It also important to point out that when I changed the code as above to honor the return value from provider, the initial controller configuration did not not go through as many errors were displayed. . In other words, it seems people have been relying on this bug.

Comment by Reinaldo Penno [ 22/Aug/14 ]

What's the progress on this one? Without this working I can not sanitize RESTconf operations

Comment by Tony Tkacik [ 18/Sep/14 ]

This requires API enhancement for new DataBroker described in CONTROLLER-662 which will introduce new API AsyncConfigutationCommitCohort with better semantics then original deprecated DataCommitHandler.

Comment by Reinaldo Penno [ 29/Oct/14 ]

Requirements:

  • I would like to attach a CommitHandler much like a data listener (to a specific leaf , subtree, etc). This is because certain portions of the tree will have different business logic associated with them. Some I will have to contact another external server, some will be just a matter of validating some of the input.
  • I would like to define the error code and reason phrase RESTconf will send back. I do not want all errors to be 401. Based on the business logic output I will decide on the appropriate error. Of course if no error is passed from ODL Provider, infrastructure can return a default error
  • Following up on above, I would like to be able to return 3XX code with appropriate payload. The reasons are many: Load-balancing, redirection to appropriate ODL or server instance that should handle resource, etc. This has been a long requirement since it is heavily used by business apps. This could be done with a Yang metadata data. A metadata-tag that we can change run-time with the URI to be used for redirection.
Comment by George Zhao [ 19/Jan/15 ]

move to Lithium

Comment by Reinaldo Penno [ 03/Mar/15 ]

Any update? I would like to incorporate the new API into SFC with plenty of time to test, give feedback, fix bugs, stabilize.

Comment by Tony Tkacik [ 19/Mar/15 ]

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

Comment by Reinaldo Penno [ 31/Mar/15 ]

Any update? Code review seems stuck and did not receive any updates either.

Comment by Tony Tkacik [ 01/Apr/15 ]

https://git.opendaylight.org/gerrit/#/c/17532/1 - Binding to DOM part

DOM to Data Store part is yet pending.

Comment by Tony Tkacik [ 28/Jan/16 ]

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

Comment by Colin Dixon [ 10/Feb/17 ]

adding some keywords to make searching easier:
validation data validate cohort cohorts

Generated at Wed Feb 07 20:08:29 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.