Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Ensure storage constraints are removed when an application is deleted #7421
Conversation
axw
requested changes
May 31, 2017
There's no explanation as to why the existing code isn't doing what it should, and I can't see a logical reason for why stopping finalAppCharmRemoveOps from being called in some instances and making an unconditional call to it from removeOps would resolve the problem. The ops returned by finalAppCharmRemoveOps do not contain any assertions. Presumably the issue is that something is that the "isFinal" block isn't executing, which indicates the refcount is >1. Why would it be?
There's a comment that states there's a workaround. Why isn't it working?
|
The existing code doesn't work because a single txn slice contains 2 dec ref operations. This is what the code comment refers to. The workaround mentioned in removeOps simply didn't exist - the code comment was wrong. The code comment also mentions that finalAppCharmRemoveOps should be idempotent. It might be, but it schedules a cleanup op and we really don't want to incur the overhead of doing that unnecessarily. |
anastasiamac
approved these changes
May 31, 2017
FWIIW, having been in this area and pondering about it while destroying models with empty applications, this actually a pretty nice approach to resolving the issue of trying to determine when and if to add final clean up to collection of operations to remove an application, a unit, etc..
But why are there 2 dec ref operations? How does the act of removing an application incur 2 "remove application" operations? That seems wrong. EDIT: in case it's not clear, I do understand the issue of 2 dec refs in the one transaction. To address that in the long term, we should look at introducing a transaction builder which will retain information in memory about things like ref counts, whether an entity was just created, etc. The transaction builder would create the initial transaction op for a decref, and then subsequent decrefs would change the -1 to a -2, etc. What I don't understand is why this applies to removing an application. It does not seem intuitive or even logical. |
axw
approved these changes
Jun 1, 2017
After speaking with Ian, the issue is apparently related to the cleanup and removal of units, rather than just removing the application. So LGTM (or Looks Adequate To Me at least ;)), as long as we get the unit test fixed.
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
wallyworld commentedMay 31, 2017
Description of change
When removing an application, ensure that artefacts such as storage constraints are also removed.
QA steps
$ juju bootstrap aws
$ juju deploy postgresql --storage pgdata="ebs,10G"
$ juju remove-application postgresql
wait for postgresql app to disappear from status after it cleans itself up
$ juju deploy postgresql --storage pgdata="ebs,10G"
Bug reference
https://bugs.launchpad.net/juju/+bug/1687878