Project

Profile

Help

Issue #1467 ยป Issue #7630 - 2016-01-04T22_31_00Z.eml

rbarlow, 01/04/2016 11:31 PM

 
Date: Mon, 04 Jan 2016 23:31:00 +0100
From: rbarlow@redhat.com
To: dropbox+pulp+c71e+pulp@plan.io
Message-ID: <568af2a42d47_1bdf3ffafea57a247305c@mercury.mail>
in-reply-to: redmine.journal-7625.20160104171441.a2ad9783a7c52b0a@plan.io
Subject: Re: [Pulp - Issue #1467] Repository unit counts are not always
accurate when the plugin authors forget to update them
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary=ef5uBRDD8xasInSjjqdbGGwXCF1Qv2ewH;
charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
X-HE-Spam-Level: ------
X-HE-Spam-Score: -6.0
X-HE-Spam-Report: Content analysis details: (-6.0 points) pts rule name
description ---- ----------------------
-------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL:
Sender listed at http://www.dnswl.org/, high trust [209.132.183.28 listed in
list.dnswl.org] -1.0 ENCRYPTED_MESSAGE Message is encrypted, not likely to be
spam
X-HE-SPF: PASSED


--ef5uBRDD8xasInSjjqdbGGwXCF1Qv2ewH
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Pulp wrote:
> Does it make any sense to implement this as a save() or post_save()
> callback on RepositoryContentUnit itself? New saves vs updates could be=

> handled accordingly. We could also hook delete(). We may loose a little=

> bit of performance doing it unit by unit, but the update can be done
> efficiently such as with the update_unit_count() method. This would tak=
e
> us closer to an object oriented design.

Unfortunately, save()/delete() are only called when individual units are
saved/deleted, not when collection-wide update queries are called. I'm
not sure what kinds of queries are performed in all cases, but if any
bulk-insert queries are used this wouldn't work. In general, it's not
great to rely on save and delete in this way for models with Mongoengine
(or Django either).

-- =

Randy Barlow
irc: bowlofeggs

--ef5uBRDD8xasInSjjqdbGGwXCF1Qv2ewH--
    (1-1/1)