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
[WIP] Purge miq requests every 6 months #21577
base: master
Are you sure you want to change the base?
Conversation
I wonder if we need to look for the related You can see my similar work, but for queue work that was in flight when a worker was killed, here: https://github.com/ManageIQ/manageiq/pull/21485/files |
Note, I'm ok with waiting on that. I honestly just don't know enough of what the various tables hold and how they're used with each type of thing, provision, services, etc. to say what's right or wrong. |
MiqRequestTask.where(:miq_request_id => ids).destroy_all | ||
MiqApproval.where(:miq_request_id => ids).delete_all |
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.
Should this be done in batches or does the mixin already do that?
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.
the miq requests are batched. So I was thinking that we would just get rid of all the associated approvals.
Since this is a delete_all
, no records will come back over the wire so I was less concerned around this one.
(it is the destroy_all
that is concerning to me)
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.
yeah I was talking about the destroy_all in batches - didn't realize I commented on the wrong line.
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'm guessing there are probably 1 task per request. So the batching size should be about the same.
Not sure if this does it one by one.
Since we implemented purge_associated_records
, we download all the ids.
@kbrock did you get a chance to look at #21577 (comment) ? I don't know if we can clean up some of these without getting their associated other requests/tasks. Maybe it will just work since they will all get purged after 6 months anyway? I don't know. Maybe this PR is just simpler. |
WIP: I do not know how to detect if this workflow is still running. (per @jrafanie comments) So it is possible that we destroy a long running workflow. Although, a workflow that runs for 6 months is quite long. Not purging associated records but purging all tasks/requests older than a certain date would work. I just worry that we delete a request that is part of a service template or something. I seem to remember workflows being creative in how they stored the templates. |
ffc9821
to
5a5a58d
Compare
@jrafanie do we want to merge this with #21485 ? There was more thought for what records want to be deleted over there I think the main thing that needs to be done with this pr is we need to change We possibly want to change the way associated records need to be purged, but that would be an optimization |
This pull request has been automatically closed because it has not been updated for at least 3 months. Feel free to reopen this pull request if these changes are still valid. Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
outstanding: not sure how to determine which workflows are still running, so can't determine if it is safe to delete a workflow. |
This pull request has been automatically closed because it has not been updated for at least 3 months. Feel free to reopen this pull request if these changes are still valid. Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
5a5a58d
to
61971c6
Compare
update
Still WIP: just like #21485 - tricky to determine whether a workflow is still in use, and therefore don't want to delete a request out from underneath the workflow |
This pull request has been automatically closed because it has not been updated for at least 3 months. Feel free to reopen this pull request if these changes are still valid. Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
Checked commit kbrock@61971c6 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
This pull request is not mergeable. Please rebase and repush. |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
We have no process to clear out miq requests.
If we do not want to automatically delete these, I would feel more comfortable putting most of this PR in but removing the scheduler to automatically create them.
I am concerned about
MiqRequestTask.where().destroy_all
. I remember there was some trick with the tasks that do have child tasks, but can't remember the actual nuance. For this reason, I stuck with destroy. But we are going to bring a lot of records over the wire.MiqApproval
is more straight forward and we can usedelete_all