Bug 806068

Summary: Deleting repo does not delete associated packages and errata from search index
Product: Red Hat Satellite Reporter: Brad Buckingham <bbuckingham>
Component: WebUIAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED ERRATA QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: cpelland, cwelton, hbrock, mmccune
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-15 18:59:14 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: 807516    
Bug Blocks:    

Description Brad Buckingham 2012-03-22 20:11:29 UTC
Description of problem:

This issue would actually exist with both the UI and CLI.

If the user creates a repository, syncs it and then deletes it, the search server's index is not updated to remove the packages and errata previously indexed.

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

How reproducible:
always

Steps to Reproduce:
1. create a provider/product/repo (zoo2/zoo2/zoo2)
2. sync the repo (zoo2)
3. perform a query on elastic search (using curl) for a package in the repo

4. delete the repo (zoo2)
5. perform a query on elastic search (using curl) for a package in the repo

6. re-create and sync the repo (zoo2)
7. perform a query on elastic search (using curl) for a package in the repo

see results for example of steps 3, 5 & 7
  
Results:

step 3: results are good/expected ("hits" => "total" : 1 => this is what we expected)
-----------------------------------------------------------------------
curl -X GET "http://localhost:9200/katello_package/_search?pretty=true" -d '{"size":1,"query":{"query_string":{"query":"nvrea:cam*"}},"from":0}'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "katello_package",
      "_type" : "package",
      "_id" : "cbe9bab8-665f-466f-bcca-3fa517dc1356",
      "_score" : 1.0, "_source" : {"repo_defined":true,"vendor":"","_type":"package","_id":"cbe9bab8-665f-466f-bcca-3fa517dc1356","provides":["camel"],"requires":[],"name":"camel","_ns":"packages","checksum":{"sha256":"82e497ca3e7affb5682362b50537af290d0a202e4ad00b6ef62357a2cc9819ba"},"arch":"noarch","id":"cbe9bab8-665f-466f-bcca-3fa517dc1356","group":"Internet/Applications","repoids":["ACME_Corporation-zoo2-zoo2"],"description":"A dummy package of camel","download_url":"https://localhost//pulp/repos/ACME_Corporation/Library/custom/zoo2/zoo2/camel-0.1-1.noarch.rpm","nvrea_sort":"camel-0.1-1.noarch","size":2439,"filename":"camel-0.1-1.noarch.rpm","epoch":"0","license":"GPLv2","buildhost":"smqe-ws15","nvrea":"camel-0.1-1.noarch","release":"1","version":"0.1"}
    } ]
  }

step 5: results bad ("hits" => "total" : 1 => did not expect to see any results since repo was deleted)
----------------------------------------------------------------------
curl -X GET "http://localhost:9200/katello_ackage/_search?pretty=true" -d '{"size":1,"query":{"query_string":{"query":"nvrea:cam*"}},"from":0}'
{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "katello_package",
      "_type" : "package",
      "_id" : "cbe9bab8-665f-466f-bcca-3fa517dc1356",
      "_score" : 1.0, "_source" : {"repo_defined":true,"vendor":"","_type":"package","_id":"cbe9bab8-665f-466f-bcca-3fa517dc1356","provides":["camel"],"requires":[],"name":"camel","_ns":"packages","checksum":{"sha256":"82e497ca3e7affb5682362b50537af290d0a202e4ad00b6ef62357a2cc9819ba"},"arch":"noarch","id":"cbe9bab8-665f-466f-bcca-3fa517dc1356","group":"Internet/Applications","repoids":["ACME_Corporation-zoo2-zoo2"],"description":"A dummy package of camel","download_url":"https://localhost//pulp/repos/ACME_Corporation/Library/custom/zoo2/zoo2/camel-0.1-1.noarch.rpm","nvrea_sort":"camel-0.1-1.noarch","size":2439,"filename":"camel-0.1-1.noarch.rpm","epoch":"0","license":"GPLv2","buildhost":"smqe-ws15","nvrea":"camel-0.1-1.noarch","release":"1","version":"0.1"}
    } ]
  }
}

step 7: bad results again ("hits" => "total" : 2 => expected there to only be 1 result)
------------------------------------------------------------------------------
curl -X GET "http://localhost:9200/katello_ackage/_search?pretty=true" -d '{"size":1,"query":{"query_string":{"query":"nvrea:cam*"}},"from":0}'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "katello_package",
      "_type" : "package",
      "_id" : "cbe9bab8-665f-466f-bcca-3fa517dc1356",
      "_score" : 1.0, "_source" : {"repo_defined":true,"vendor":"","_type":"package","_id":"cbe9bab8-665f-466f-bcca-3fa517dc1356","provides":["camel"],"requires":[],"name":"camel","_ns":"packages","checksum":{"sha256":"82e497ca3e7affb5682362b50537af290d0a202e4ad00b6ef62357a2cc9819ba"},"arch":"noarch","id":"cbe9bab8-665f-466f-bcca-3fa517dc1356","group":"Internet/Applications","repoids":["ACME_Corporation-zoo2-zoo2"],"description":"A dummy package of camel","download_url":"https://localhost//pulp/repos/ACME_Corporation/Library/custom/zoo2/zoo2/camel-0.1-1.noarch.rpm","nvrea_sort":"camel-0.1-1.noarch","size":2439,"filename":"camel-0.1-1.noarch.rpm","epoch":"0","license":"GPLv2","buildhost":"smqe-ws15","nvrea":"camel-0.1-1.noarch","release":"1","version":"0.1"}
    } ]
  }
}

Additional info:

Comment 1 Brad Buckingham 2012-03-28 13:23:15 UTC
Found an issue with pulp that we'll need to resolve in order to resolve this one.  Created bug 807516 for that issue.  It is actively being worked.

Comment 2 Brad Buckingham 2012-03-28 19:41:45 UTC
katello commit - 3046522152a23dc9f4cc22cabd06a1781e18bd73

When repo is deleted, if the repo is the only one associated with a given pkg or errata, the index entries for those pkg or errata are removed.  If, however, there are multiple repos associated with a given pkg or errata, the deleted repo will be removed from the list of repoids.

Comment 5 Corey Welton 2012-03-30 18:45:00 UTC
QA Verified - 0.1.307-1.el6:

After initially creating and syncing the repo, the query returns one result.
After deleting repo and repeating query, result disappeares
After recreating and syncing the repo, the query once again returns one and only one result.

Comment 6 errata-xmlrpc 2012-05-15 18:59:14 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.

http://rhn.redhat.com/errata/RHEA-2012-0665.html

Comment 7 Mike McCune 2013-08-16 18:22:02 UTC
getting rid of 6.0.0 version since that doesn't exist