Bug 1301383 - Search query returns wrong value for tag association
Search query returns wrong value for tag association
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine
Classification: oVirt
Component: Search-Backend (Show other bugs)
3.6.2
Unspecified Unspecified
unspecified Severity low (vote)
: ovirt-4.0.0-alpha
: 4.0.0
Assigned To: Eli Mesika
Petr Kubica
:
: 1301385 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-24 12:23 EST by Nelly Credi
Modified: 2016-07-05 03:39 EDT (History)
5 users (show)

See Also:
Fixed In Version: ovirt 4.0.0 alpha1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-05 03:39:28 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
rule-engine: ovirt‑4.0.0+
rule-engine: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 52797 None None None 2016-01-27 06:59 EST

  None (edit)
Description Nelly Credi 2016-01-24 12:23:38 EST
Description of problem:
If you have the same query, but expecting different result, 
the query may return wrong value
My example is on tags, where there is a host associated with it, but the query returns empty host list, but it maybe for other queries as well

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


How reproducible:
100%

Steps to Reproduce:
1.create tag - tag_1
2.associate host with it
3.search - /api/hosts;max=-1;case_sensitive=true?search=tag=tag_*
4.de-associate
5.delete tag_1
6.create tag_2
7.associate host with it
8.search - /api/hosts;max=-1;case_sensitive=true?search=tag=tag_*

Actual results:
empty host list
<hosts />

Expected results:
the associated host

Additional info:
* If you query /api/hosts;max=-1;case_sensitive=true?search=tag=tag_2 it will return with correct search result

* it doesnt matter which API you use, you can start with rest & move to cli, but still the result will be the same - empty host list

* maybe there is some caching?
Comment 1 Gil Klein 2016-01-25 04:46:34 EST
*** Bug 1301385 has been marked as a duplicate of this bug. ***
Comment 2 Juan Hernández 2016-01-25 07:11:36 EST
There is a cache in the "SearchQuery.queriesCache" static field that stores the SQL code generated from the search text. This data in this cache is cleared when it is one day old. In addition the "BaseConditionFieldAutoCompleter.formatValue" method translates the search text so that if it includes something like "tag=whatever" the "whatever" part is converted into set of identifiers of the tags that match it, before generating the SQL code. In you case it will be translated into the id of "tag_1". The resulting SQL is then stored in the cache, and will stay there for one day. So even if you remove "tag_1" the cached SQL statement will still contain the identifier of the removed "tag_1", thus producing zero results.
Comment 3 Petr Kubica 2016-06-14 08:49:05 EDT
Verified in 4.1.0-0.0.master.20160613231338.git6e72c0b.el7.centos
Comment 4 Sandro Bonazzola 2016-07-05 03:39:28 EDT
oVirt 4.0.0 has been released, closing current release.

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