Bug 645694

Summary: Need taskomatic job to purge unreferenced records from rhnPackageChangeLogData
Product: [Community] Spacewalk Reporter: Jan Pazdziora <jpazdziora>
Component: ServerAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: low    
Version: 1.2   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-08 08:42:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 653453    

Description Jan Pazdziora 2010-10-22 09:24:47 UTC
Description of problem:

For Spacewalk 1.2, we have split rhnPackageChangeLog into rhnPackageChangeLogData (the data) and rhnPackageChangeLogRec (the relation table which links the data to individual package).

Whe package is deleted, so is record from rhnPackageChangeLogRec. However, the record from rhnPackageChangeLogData does not get deleted because it might be referenced from other packages, and for performance reasons we don't do that lookup right away.

We need daily taskomatic task which will do something like

    delete from rhnPackageChangeLogData
    where id not in ( select changelog_data_id from rhnPackageChangeLogRec )

There is index on rhnPackageChangeLogRec(changelog_data_id) so it should be pretty fast.

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

spacewalk-schema-1.2.46-1

How reproducible:

Should be easy.

Steps to Reproduce:
1. Push or sync a package.
2. Check that there are records in rhnPackageChangeLogRec and rhnPackageChangeLogData.
3. Remove that package.
4. Check that the records from rhnPackageChangeLogRec are gone but records in rhnPackageChangeLogData are still there.
5. Wait a day.
  
Actual results:

Records in rhnPackageChangeLogData are still there.

Expected results:

Orphaned records got purged from rhnPackageChangeLogData.

Additional info:

Comment 1 Tomas Lestach 2010-11-15 14:05:38 UTC
Introducing cleanup-packagechangelog-data task
    
    this task is scheduled once a day together with another clean up task
    and cleans up unreferenced records from the rhnPackageChangeLogData table

spacewalk.git: 6c1ee1ef54b4593b406cb111b0b86cc1a3c12949

Comment 2 Tomas Lestach 2011-02-03 12:21:41 UTC
Moving ON_QA ...

Comment 3 Tomas Lestach 2011-02-08 08:42:06 UTC
This bug has been fixed in Spacewalk 1.3.