Bug 1494688

Summary: Duplicate entries in taxable_taxonomies table
Product: Red Hat Satellite Reporter: Jonathon Turel <jturel>
Component: Organizations and LocationsAssignee: Tomer Brisker <tbrisker>
Status: CLOSED ERRATA QA Contact: Ales Dujicek <adujicek>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.11CC: adujicek, akarsale, cduryee, mhulan, tbrisker, tstrachota
Target Milestone: 6.4.0Keywords: FieldEngineering, PrioBumpField, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 19:00:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathon Turel 2017-09-22 20:20:05 UTC
Description of problem:

It is possible for duplicate entries to be placed in taxable_taxonomies table.

Example:

  id   | taxonomy_id | taxable_id | taxable_type |         created_at         |         updated_at         
-------+-------------+------------+--------------+----------------------------+----------------------------
 17766 |          15 |         76 | Subnet       | 2017-08-10 09:05:41.651359 | 2017-08-10 09:05:41.651359
 17767 |          15 |         76 | Subnet       | 2017-08-10 09:05:41.687729 | 2017-08-10 09:05:41.687729

Notice the consecutive ids and virtually identical created_at timestamps


Version-Release number of selected component (if applicable): Satellite 6.2.11


How reproducible: No known reproducer - but seems like the point in time which the row is created is a good starting point. Possible that a unique constraint could be placed around (taxonomy_id, taxable_id).


Steps to Reproduce:
1.
2.
3.

Actual results: Duplicate entries as shown in the example

Expected results:

select taxable_type, taxable_id, taxonomy_id, COUNT(*) as Duplicates from taxable_taxonomies GROUP BY taxable_type, taxable_id,taxonomy_id HAVING COUNT(*) > 1;

This query should not ever return results.


Additional info: This manifests via APIs which deal with taxonomies such as Locations

curl -X GET -k -u admin https://localhost/api/v2/subnets/:subnet_id/locations"

Comment 3 Tomer Brisker 2017-11-26 12:59:36 UTC
Created redmine issue http://projects.theforeman.org/issues/21766 from this bug

Comment 4 Satellite Program 2017-11-26 13:22:17 UTC
Upstream bug assigned to tbrisker

Comment 5 Satellite Program 2017-11-26 13:22:22 UTC
Upstream bug assigned to tbrisker

Comment 6 Satellite Program 2017-11-27 15:19:33 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21766 has been resolved.

Comment 8 Bryan Kearney 2018-10-16 19:00:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2927