Project

Profile

Help

Issue #4604

closed

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

Added by ipanova@redhat.com over 5 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 51
Quarter:

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.


Files

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

Updated by CodeHeeler over 5 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 51
Actions #3

Updated by ipanova@redhat.com over 5 years ago

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

Updated by ipanova@redhat.com over 5 years 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
Actions #5

Updated by bmbouter over 5 years ago

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

Actions #6

Updated by ipanova@redhat.com over 5 years ago

  • Status changed from POST to MODIFIED

Applied in changeset commit:pulpcore-plugin|01b5dd2a38c4f55fc710fb86b8fde8c92d4175bf.

Actions #7

Updated by ipanova@redhat.com over 5 years ago

  • Tags Pulp 3 added
Actions #8

Updated by daviddavis over 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #9

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3)
Actions #10

Updated by bmbouter almost 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF