-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use latest code if action's revision is mismatched #4954
Conversation
case DocumentRevisionMismatchException(_) => | ||
// if revision is mismatched, the action may have been updated, | ||
// so try again with the latest code | ||
handleActivationMessage(msg.copy(revision = DocRevision.empty)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be controversial but I think the system should take care of this.
This is to handle the case where the underlying actions are updated while a sequence action is being invoked.
If we consider the sequence as just a coordinator for underlying actions, it would be fine for it to always invoke the latest code. Once a sequence action is defined with some actions, we don't need to update the sequence action whenever the underlying actions are updated. It means the sequence action itself does not care about the version of actions in it but just focuses on the relation and the execution order of them.
So I think it is reasonable to invoke the latest codes all the time.
And regarding the implementation, while this is great, can we differentiate the sequence case with the others?
I feel like there can be some side effects.
For example, if any activation sent to Kafka arrives at the invoker side late, it could happen.
In such a case the activation is intended for the old codes but the latest code will be invoked with this change.
I did not look into code deeply yet, but can we make the controller setup subsequent activations with the latest codes while invoking a sequence action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review and I understand your concern.
For example, if any activation sent to Kafka arrives at the invoker side late, it could happen.
In such a case the activation is intended for the old codes but the latest code will be invoked with this change.
Currently, Openwhisk doesn't have a versioning feature. So I don't think there's any problem with always serving the latest code if the DB can't fetch the older version, because action developers are responsible for compatibility between old and new action codes.
HDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite sure about this.
It would be great to listen to other reviewers' opinions as well.
From some point of view, it could be a semantic change as activations that are supposed to be rejected would be invoked successfully.
(With an assumption that the codes are backward compatible.)
How about sending an email to the dev list to get more people to attend this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave at least a warning log to describe the system takes a fallback to the latest codes because of the revision mismatch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're also working on versioning - I think this change should be considered in that broader context.
If the sequence or composition references actions specifically by version, then it should be an error to invoke an alternate version. If the sequence uses "latest" then this change is acceptable.
Was the intent for this change strictly to address compositions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
That needs to be considered in the action versioning feature I think.
CC: @jiangpengcheng
@@ -501,6 +501,46 @@ class WskSequenceTests extends TestHelpers with WskTestHelpers with StreamLoggin | |||
checkEchoSeqRuleResult(newRun, seqName, JsObject(newPayload)) | |||
} | |||
|
|||
it should "run a sub-action even if it is updated while the sequence action is running" in withAssetCleaner(wskprops) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a test case. And this test currently does not pass on the master branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a minor nit.
case DocumentRevisionMismatchException(_) => | ||
// if revision is mismatched, the action may have been updated, | ||
// so try again with the latest code | ||
handleActivationMessage(msg.copy(revision = DocRevision.empty)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave at least a warning log to describe the system takes a fallback to the latest codes because of the revision mismatch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late questions, I couldn't look sooner.
} | ||
.recoverWith { | ||
case t => | ||
// If the action cannot be found, the user has concurrently deleted it, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is still valid - why was it removed?
case DocumentRevisionMismatchException(_) => | ||
// if revision is mismatched, the action may have been updated, | ||
// so try again with the latest code | ||
handleActivationMessage(msg.copy(revision = DocRevision.empty)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're also working on versioning - I think this change should be considered in that broader context.
If the sequence or composition references actions specifically by version, then it should be an error to invoke an alternate version. If the sequence uses "latest" then this change is acceptable.
Was the intent for this change strictly to address compositions?
Description
It fixes #4953
If the action is updated while the sequence action is executing, the old revision is referred to when the sub action is executed.
At this time, if the DB server returns the latest revision, then a boxed error occurs due to an assert condition.
error message
To avoid this error, I've updated the code to retry with the latest code if the revision is different.
Related issue and scope
My changes affect the following components
Types of changes
Checklist: