Skip to content
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

resources: Don't run multiple cleanups for one storage path #7664

Merged
merged 2 commits into from Jul 21, 2017

Conversation

babbageclunk
Copy link
Contributor

@babbageclunk babbageclunk commented Jul 21, 2017

Description of change

Destroying an application with units would result in multiple cleanups being scheduled for the same storage path, because there are resource records for the application and the units. Change ResourcePersistence.NewRemoveResourcesOps to only schedule a cleanup once for a given path.

If a resource blob had already been deleted from storage when the cleanup ran, it would fail (logging an error) and leave the cleanup record around. This would prevent migrations, since the source precheck
ensures there aren't any cleanups. If the blob's already gone, the cleanup should succeed.

QA steps

  • Deploy an application that takes a resource (like cs:~cmars/mattermost).
  • Remove the application.
  • Check that there are no errors in the log about failed cleanups, and that only one "resourceBlob" cleanup is run.
  • Check that there are no cleanups remaining in the database once the system is idle.

Bug reference

Fixes https://bugs.launchpad.net/juju/+bug/1705352

If a resource blob had already been deleted from storage when the
cleanup ran, it would fail (logging an error) and leave the cleanup
record around. This would prevent migrations, since the source precheck
ensures there aren't any cleanups.

If the blob's already gone, the cleanup should succeed.

Fixes https://bugs.launchpad.net/juju/+bug/1705352
This was the cause of the failed cleanups for resources that were
blocking migrations. Unit and applications resources were both found and
cleanups were scheduled for them even if they had the same
storage-path. This meant that the first cleanup would succeed and the
second would fail.

Change ResourcePersistence.NewRemoveResourcesOps to only emit one
cleanup for each path.
@babbageclunk babbageclunk changed the title state: Fix resource blob cleanup when the blob is already gone resources: Don't run multiple cleanups for one storage path Jul 21, 2017
@babbageclunk
Copy link
Contributor Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jul 21, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 099ed19 into juju:2.2 Jul 21, 2017
@babbageclunk babbageclunk deleted the resource-cleanups branch July 23, 2017 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants