-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Old package assets are not removed from ES storage when package is upgraded #94340
Comments
Pinging @elastic/fleet (Team:Fleet) |
I don't know if this is a bug, but it is intentional. Perhaps we still want to change the behavior anyway. From the design doc:
The rationale being, it's better to keep too many and let the user/system explicitly choose to deal with them (via the API, etc) than delete them too soon and not support a use case. As I said, perhaps we do want to change this behavior. I just think we should be confident that there's agreement with Product on the desired scenarios and eng/QA to confirm the actual behavior before changing it. |
Thanks for the background @jfsiii, I understand the rationale behind avoiding deleting too early:
Right now, the only case that I see where we will need to keep an older package around is in case of upgrade failure. We should always be keeping a "last known working version" around for failover. My proposal is to delete the older version after an upgrade is 100% successful. I do not see any other cases where keeping old assets around is useful. As default packages are auto-upgraded, keeping every old version around will blow up the storage really quickly as packages get released faster. Thoughts from other team members? |
Oops, I forgot one other (major) case where we need to have older packages around: currently package policies are not upgraded automatically when a package is upgraded (#92612). This means that when editing those package policies, we retrieve the package information for the older package version. Currently we retrieve it from ES storage, which is nice since it mitigates risk of if the older version is somehow not available on the registry. I'm assigning myself to do some research and proposal for #92612, so I will think about how ES storage of packages affects that. In the meantime I'm putting this in the backlog until a consensus is reached. |
After getting up to speed with how the Fleet plugin uses these Saved Object types, I agree we should begin cleaning these old Large number of Saved Objects can cause Kibana's Saved Object migration system to take longer on each Stack upgrade (including patch upgrades). One problem with delaying any changes here is that in the meantime, this problem will continue to grow so that upgrading to a future version where this is fixed won't be possible (or at least, not easy) since the migration system runs before Fleet would have a chance to delete these old objects. The Saved Object migration system does have a basic mechanism for filtering out unneeded objects (such as SO types that are no longer used at all). The problem is that the basic mechansim only has the ability to provide simple filter, whereas in this case we cannot easily create a filter without first querying Elasticsearch. Migrations also have a workaround for this scenario, but it may be removed in a future version due to the risk it adds to upgrades (see #106991). Since we Fleet was fairly recently released as GA, I think we should try to solve this problem without introducing further risk to upgrades by:
In both of these scenarios we should be pretty defensive about making the decision to delete an older package version. At minimum we need to check that no @kpollich Any other considerations that we need to make based on how the upgrade policy API works today? |
Once the policy conflicts are resolved, when do we check |
Package assets are not removed from ES storage when a package is upgraded. Example:
apache
Old
New
On the same Settings page, if you trigger a delete of the package, the assets for the new version are removed, but the assets for the old version are still present. So this leads me to believe that the storage behavior on package upgrade is inconsistent, and we should be wiping the old package assets on successful upgrade.
We've had issues with large amount of SOs before, so not wiping the old assets will blow up the amount of
epm-packages-assets
pretty quickly, especially for default packages that are auto-upgraded.The text was updated successfully, but these errors were encountered: