Project

Profile

Help

Issue #4604

Remove duplicates does not work properly if there are multiple repeated content types in the repo

Added by ipanova@redhat.com 7 months ago. Updated 6 months ago.

Status:
MODIFIED
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 51

Description

It got manifested in docker plugin.
Snippet code:

    async def run(self):
        """ 
        The coroutine for this stage.
        Returns:
            The coroutine for this stage.
        """ 
        async for batch in self.batches():
            rm_q = Q()
            for d_content in batch:
                if isinstance(d_content.content, self.model):
                    unit_q_dict = {
                        field: getattr(d_content.content, field) for field in self.field_names
                    }
                    # Don't remove *this* object if it is already in the repository version.
                    not_this = ~Q(pk=d_content.content.pk)
                    dupe = Q(**unit_q_dict)
                    rm_q |= Q(dupe & not_this)
            queryset_to_unassociate = self.model.objects.filter(rm_q)
            self.new_version.remove_content(queryset_to_unassociate)

            for d_content in batch:
await self.put(d_content)

When we process declarative_content.content in the batch that is different from the model we are supposed to remove the dupes, we end up to have rm_q empty which leads to removal of whole content of the model.

Screenshot from 2019-03-29 15-22-09.png (259 KB) ipanova@redhat.com, 03/29/2019 03:22 PM Screenshot from 2019-03-29 15-22-09.png
250

Associated revisions

Revision 01b5dd2a View on GitHub
Added by ipanova@redhat.com 7 months ago

Remove duplicates does not work properly if there is multiple content types in the repo.

closes #4604
https://pulp.plan.io/issues/4604

History

#2 Updated by CodeHeeler 7 months ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 51

#3 Updated by ipanova@redhat.com 7 months ago

  • Status changed from NEW to POST
  • Assignee set to ipanova@redhat.com

#4 Updated by ipanova@redhat.com 7 months ago

  • Subject changed from Remove duplicates does not work properly if there is multiple content types in the repo to Remove duplicates does not work properly if there are multiple repeated content types in the repo

#5 Updated by bmbouter 7 months ago

@ipanova I love the screenshot! It shows the problem exactly. I'm looking at this PR now.

#6 Updated by ipanova@redhat.com 7 months ago

  • Status changed from POST to MODIFIED

#7 Updated by ipanova@redhat.com 7 months ago

  • Tags Pulp 3 added

#8 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#9 Updated by bmbouter 6 months ago

  • Tags deleted (Pulp 3)

Please register to edit this issue

Also available in: Atom PDF