Bug 785170

Summary: Possible duplicate and unneeded entitlement regenerations on import
Product: [Retired] Subscription Asset Manager Reporter: James Bowes <jbowes>
Component: candlepinAssignee: Alex Wood <awood>
Status: CLOSED CURRENTRELEASE QA Contact: Tazim Kolhar <tkolhar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: awood, bkearney, cwelton, omaciel
Target Milestone: ---Keywords: Triaged
Target Release: ---Flags: tkolhar: needinfo+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-07 17:19:56 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: 816564    

Description James Bowes 2012-01-27 14:11:03 UTC
On a manifest import, there are two causes of entitlement regens:

- ProductImporter detecting changes will regenerate any entitlements that use the 
  referenced product.

- Importer calls refreshPools.

ProductImporter and refreshPools can very easily regenerate the same entitlements.
In addition, with the new environment/content changes, ProductImporter might regenerate an entitlement that doesn't even have content that was altered.

IMO, We should teach ProductImporter to: Iterate over all imported products. If the product's toplevel information or attributes have changed, determine all entitlements that will need to be regenerated, and keep this as a set.
For any products other products, if a product's content set is modified or deleted, add all entitlements that use that content set to the set of entitlements that need to be regenerated. Pass this set back up to importer.

refreshPools now needs some way to pass up all entitlements that it would regenerate, and instead of regenerating them, return them to Importer.
Importer can now merge these two lists, and now regenerate each entitlement once and only once.

Lastly, ProductImporter should be copying modified attributes onto all pools that reference that product (across all orgs).

Comment 2 Alex Wood 2012-03-05 20:09:54 UTC
Committed 4b58e8a949625cef4599b554bd902425a078fbc7

Available 0.5.24+

Comment 3 James Bowes 2012-03-05 20:20:11 UTC
Ignore that last bit about copying modified attributes. that's a different issue, so I opened a new bug for it: https://bugzilla.redhat.com/show_bug.cgi?id=800145

Comment 5 Tazim Kolhar 2012-11-27 05:00:28 UTC
Hi all,
Please provide the verification steps to complete the testing. thanks

Comment 6 Alex Wood 2012-11-27 17:50:37 UTC
This bug is verified through our unit test suite.  Unfortunately, there is no real way to test this by hand.

Comment 8 Bryan Kearney 2013-06-07 17:24:56 UTC
Closing out verified bugs from 1.2. Somehow the errata tool missed them.

Comment 9 Bryan Kearney 2013-06-07 17:25:46 UTC
Closing out verified bugs from 1.2. Somehow the errata tool missed them.