-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict in TCK: unable to cancel already closed nested LRA #274
Comments
Possible solutions (I assume we can't change the semantics of Compensate methods):
|
This is about when the LRA method is executed, not about when the @compensate annotated method is executed. I also doesn't see any change in #265 which indicates that something has changed regarding when the @compensate annotated method can be executed. In the section of
So I for me this issue is invalid. |
@rdebusscher what do you mean, please? In the copied statement it is said that we are talking about LRA methods (e.g., Compensate - requires that received/created LRA is active when the LRA method is invoked). The issue is that in the test the LRA is closed by the user and then canceled by the user. So when the cancel is invoked, it is invoked with already closed (thus ended) LRA id which means that in both Compensate and AfterLRA participant cases the execution will be rejected as participant cannot enlist with closed LRA id. This issue is not about Complete or AfterLRA calls per se. It is about the calls to LRA methods where we now require that all LRA resources must be participants or afterLRA listeners. |
Correct, my mistake. I see it also now that nested LRA is immediately closed when called. I was mixing it up with another test that verifies if the nested @compensate is called when parent is cancelled. We could define another nested LRA which can be cancelled, but I do not see the intention of the test (what does it test in relation to the spec?). So maybe we can remove the test. |
@mmusgrov can explain more what the test is needed for. But from my understanding this the only test that verifies that nested LRA can be canceled even after it was previously closed. Also as I mentioned, it will be possible to implement this case when we introduce a non-participating party to the spec (e.g., LRAClient API). But of course, we can remove the test now and add it again when it will be possible to implement it. |
To my understanding, a nested LRA can be cancelled (the @compensate is called) after it had been closed because the parent is cancelled. Not because the nested is cancelled explicitly after it is closed since the nested LRA itself is no longer active. |
I wasn't able to find a mention of the user cancel of nested LRA in the specification document. Only as @rdebusscher described. @mmusgrov can the test be removed or am I missing something? |
The test is valid. The spec says: "A nested LRA which has closed must retain the ability to cancel the effects if the the parent cancels" So in the TCK test we close the nested LRA. The nested participant must retain the ability to cancel the effects (ie the @compensate method if invoked must reverse the effects even though the nested LRA has closed). The nested participant must continue to provide this guarantee until it has been told to forget about the nested LRA. In other words those other issues you reference do not invalidate this requirement. |
@mmusgrov the test tries to cancel this closed nested LRA as a user manually. Not by canceling parent LRA. So even if nested the sequence of events is: 1/ start LRA with All these operations performed by the user. |
Actually I spoke too soon. The test is valid since we must allow closed nested LRAs to be cancelled (it is part of the structuring mechanisms that our spec facilitates). The correct fix is update the section where we discuss validation of LRAs and add the caveat for nested LRAs. |
@mmusgrov so for nested LRA we allow LRA execution with inactive LRA id but there will be no enlistment? |
The nested LRA will not be in the ACTIVE state and since our state model only allows enlistment with active LRAs then enlistment should fail. But if a resource is invoked with a CLOSED nested LRA and if the resource is not already enlisted then we return an error code. But if it is already enlisted then we allow the business method to proceed since the resource will be told to compensate if the LRA is later cancelled. The only issue with this approach is that there would be no |
What if the LRA business method closes the nested LRA again?
Where there would be no |
Why would that cause a problem?
On the resource representing the nested participant.
It is not possible to close a cancelled nested LRA. See the javadoc for the LRA annotation nested element. |
So further to my last comment: we need to allow the cancellation of closed nested LRAs in order to facilitate the structuring of business work and we can still support it via annotations, with a change to the existing validation logic, as follows:
When the method finishes without error the complete method, if present, would be invoked as normal. This will work since the |
PR #276 was merged |
With #244 we require now that every LRA resource must contain either Compensate or AfterLRA method:
In the TCK test
TckTests#mixedMultiLevelNestedActivity
we test the scenario where the nested LRA is first closed and then subsequently canceled. That means that we are invoking LRA method with already closed LRA which together with the requirement of #244 means that such invocations will always fail.This means that #244 basically removed the possibility of mixed nested outcomes from 1.0. It will be possible to simulate
TckTests#mixedMultiLevelNestedActivity
scenario with theLRAClient
when it will be introduced later.For now, I added ignore to
TckTests#mixedMultiLevelNestedActivity
in PR #273.The text was updated successfully, but these errors were encountered: