Bug 816553 - Duplicate rows caused by lazy_create + missing unique constraint
Duplicate rows caused by lazy_create + missing unique constraint
Status: CLOSED CURRENTRELEASE
Product: Beaker
Classification: Community
Component: scheduler (Show other bugs)
0.8
Unspecified Unspecified
urgent Severity high (vote)
: HOTFIX
: ---
Assigned To: Dan Callaghan
:
: 816638 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-26 07:53 EDT by Dan Callaghan
Modified: 2012-04-26 23:12 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-26 23:12:24 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dan Callaghan 2012-04-26 07:53:53 EDT
In the new implementation of MappedObject.lazy_create (as of 0.8.2) it relies on a suitable unique constraint being present for the columns passed to it.

We are calling lazy_create for the following tables without the necessary unique constraints:

    task_type
    task_package
    device_class
    device

This causes duplicate rows to be inserted, which manifests as problems in other parts of the code which are calling .one() on a query expecting a single unique result.

The first of this reported by users is:

    XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:'Invalid Task Type: Multihost'

when invoking bkr workflow commands, however there are many places which would exhibit similar failures due to the duplicate rows.
Comment 1 Dan Callaghan 2012-04-26 08:27:16 EDT
Patch posted to Gerrit:

http://gerrit.beaker-project.org/1034
Comment 2 Dan Callaghan 2012-04-26 23:12:24 EDT
Fix released.
Comment 3 Dan Callaghan 2012-04-26 23:12:32 EDT
*** Bug 816638 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.