<div dir="ltr"><div>Hi Simon,</div><div>these are good observations.</div><div><br></div><div>It is challenging to find balance between the freedom given to the user and still keeping the repository in a sane state.</div><div><br></div><div>General thinking is:</div><div><br></div><div dir="ltr">If a docker image manifest is *explicitly* mentioned to be removed by its digest - we perform down recursive removal even if it is referenced by a manifest list.</div><div>The reason why we also remove  the tags because they are completely useless if they point to something non-existent, meanwhile manifest list is still usable for other remaining image manifests.</div><div><br></div><div>This exact case we leave on the user's good will, especially if he has provided the digest, meaning 'he knows what he's doing' . There is other side of the coin where the restriction "you cannot delete a manifest that is still referenced by<br>
a manifest list or tag" is undesirable. It would force the user to 1) try to remove manifest X and see that you cannot because of tags A,B,C 2) removed those tags , 3) only after you can remove manifest X</div><div>or 1) before head find the tags manifest X references 2) remove tags 3) remove manifest X<br></div><div><br></div><div>As a possible solution we could add a 'force' flag that will not rely on the users' good will, but will ensure that if a user specifies it he is aware of implications. Otherwise if no 'force' flag is specified we go with behaviour:</div><div>----> <br></div><div>You can remove an artifact if no<br>
artifact on a higher level references it. If it can be removed, all<br>
(otherwise unused) artifacts on lower levels are deleted recursively.<br>
<br>
For example, you cannot delete a manifest that is still referenced by<br>
a manifest list or tag.</div><div><br></div><div><br></div><div>Thoughts?</div><div><br></div><div dir="ltr">--------<br>Regards,<br><br>Ina Panova<br>Senior Software Engineer| Pulp| Red Hat Inc.<br><br>"Do not go where the path may lead,<br> go instead where there is no path and leave a trail."<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 17, 2019 at 2:26 PM Simon Baatz <<a href="mailto:gmbnomis@gmail.com">gmbnomis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Jul 16, 2019 at 09:28:38PM +0200, Ina Panova wrote:<br>
>    Hello community,<br>
>    we are trying to gather feedback on docker content removal behaviour in<br>
>    Pulp3.<br>
>    Here are the use cases we came up with, please share your thoughts and<br>
>    expectations.<br>
>    When it is desired to remove docker content from a repo, the<br>
>    expectations are that:<br>
>       * when a docker image manifest is removed, all its blobs( not<br>
>    referenced by other image manifests) are removed as well. Also tags<br>
>    that were referencing this manifest will be removed.<br>
<br>
What should happen to manifest lists that reference the manifest? Are<br>
those removed as well? (and by extension, the tags pointing to them)<br>
<br>
>       * When a docker manifest list is removed, all its manifests( not<br>
>    referenced by other manifests lists and not tagged) are removed as<br>
>    well. Furthermore, same story with the blobs. Also tags that were<br>
>    referencing this manifest list will be removed.<br>
>       *When a tag is removed , only tag is removed.<br>
<br>
Yes, that makes sense.  I know a repo manager that removes the<br>
manifest list/manifest/blobs when the last tag is removed.  I don't<br>
like this behavior because it causes problems when adopting a<br>
workflow without tags (i.e.  using content adresses only).<br>
<br>
However, users may expect this recursive behavior as the tag may be<br>
the only identifier they are aware of.<br>
<br>
>    Do you find this recursive removal behaviour useful and expect it work<br>
>    the way it got described above? Or simple removal makes more sense,<br>
>    e.g. just image manifest and its tag are removed?<br>
<br>
I find the recursive removal very useful. As a user I expect Pulp to<br>
know the details of the artifact structure and do the "right thing".<br>
<br>
I am wondering whether we should only remove recursively "down" the<br>
reference hierarchy, but not up. AFAIK, the references are:<br>
<br>
tag -> manifest list -> manifest -> blob<br>
tag ------------------><br>
<br>
Removal would work as follows: You can remove an artifact if no<br>
artifact on a higher level references it. If it can be removed, all<br>
(otherwise unused) artifacts on lower levels are deleted recursively.<br>
<br>
For example, you cannot delete a manifest that is still referenced by<br>
a manifest list or tag.<br>
</blockquote></div>