-
Notifications
You must be signed in to change notification settings - Fork 108
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
Fix T0Request update function to avoid unneeded documents update #11353
Conversation
Jenkins results:
|
Jenkins results:
|
Jenkins results:
|
test this please |
Jenkins results:
|
Jenkins results:
|
test this please |
Jenkins results:
|
Thanks to @germanfgv for running a replay with these changes in, we can see that documents are no longer continuously and unneded updated. Checking one workflow in local couchdb:
the revision number is sound (5 updates in total), while with the buggy code it would be beyond 15 or so by now. |
} | ||
if (doc.RequestStatus && !isAllowedTransiton(doc.RequestStatus, newStatus)) { | ||
// don't update the status just ignore | ||
return "not allowed transition " + doc.RequestStatus + " to " + newStatus; | ||
return "Not allowed transition, from " + doc.RequestStatus + " to " + newStatus; |
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 always suggest to put quotes around status'es that it will increase readability especially if status is not integer data-type. For instance, if status is some sentences, e.g. 'status is ok' then reading full string will become more clear that status is shown in quotes.
Fix T0 updaterequest update function to avoid same status transition apply Valentins suggestions
another update to unit tests
@vkuznet Valentin, the javascript source code looks uglier, but it's easier on the client perspective. I updated the error message as you suggested. Please have another look. |
Jenkins results:
|
@germanfgv as discussed during the WMCore meeting today. I would recommend to apply this patch to the T0 agents, it does require a stop of the components, stop of couch, apply the couchapps patch, start of couch, push up-to-date couchapps and start all the components. Please let us know via Slack if you need help with any of this. |
WMCore Issue: dmwm/WMCore#11304 WMCore PR: dmwm/WMCore#11353
WMCore Issue: dmwm/WMCore#11304 WMCore PR: dmwm/WMCore#11353
Fixes #11304
Status
ready
Description
This PR fixes the T0Request couchapp update function, ensuring that documents transitioning from/to the same request status are not updated. In other words, if a workflow needs to be updated from status AAA to AAA, the update function will simply skip the document update (hence, the document will keep the same revision number as it had before the update call).
In addition to that, improve the TaskArchiver log record such that we can see what was the outcome of the update call.
Documentation: https://docs.couchdb.org/en/3.2.2-docs/ddocs/ddocs.html#update-functions
Is it backward compatible (if not, which system it affects?)
YES
Related PRs
None
External dependencies / deployment changes
In order to apply this patch to the T0 agent, the following set of commands is required: