Project

General

Profile

Bug #13838

Searching for hosts by facts does not return all hosts

Added by Timo Goebel about 4 years ago. Updated about 4 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
Search
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Searching for hosts by the following query does not return all expected hosts
"facts.app_tier = lxrls and facts.is_galera_arbitrator = true"

SQL issued to db with missing hosts:
SELECT `hosts`.* FROM `hosts` INNER JOIN fact_values fact_values_30 ON (hosts.id = fact_values_30.host_id) INNER JOIN fact_names fact_names_30 ON (fact_names_30.id = fact_values_30.fact_name_id) INNER JOIN fact_values fact_values_31 ON (hosts.id = fact_values_31.host_id) INNER JOIN fact_names fact_names_31 ON (fact_names_31.id = fact_values_31.fact_name_id) WHERE `hosts`.`type` IN ('Host::Managed') AND (((fact_names_30.name = 'app_tier' AND fact_values_30.value = 'lxperf') AND (fact_names_31.name = 'is_galera_arbitrator' AND fact_values_31.value = 'true'))) ORDER BY `hosts`.`name` ASC LIMIT 150 OFFSET 0

SQL issued to db returning all expected hosts (removed ext_method from scoped search):
SELECT `hosts`.* FROM `hosts` INNER JOIN `fact_values` fact_values_620066 ON (hosts.id = fact_values_620066.host_id) INNER JOIN `fact_names` fact_names_620066 ON (fact_names_620066.id = fact_values_620066.fact_name_id) INNER JOIN `fact_values` fact_values_868107 ON (hosts.id = fact_values_868107.host_id) INNER JOIN `fact_names` fact_names_868107 ON (fact_names_868107.id = fact_values_868107.fact_name_id) WHERE `hosts`.`type` IN ('Host::Managed') AND ((fact_names_620066.`name` = 'app_tier') AND (fact_names_868107.`name` = 'is_galera_arbitrator') AND ((`hosts`.`id` IN (SELECT `host_id` FROM `fact_values` WHERE `fact_values_620066`.`value` = 'lxrls' )) AND (`hosts`.`id` IN (SELECT `host_id` FROM `fact_values` WHERE `fact_values_868107`.`value` = 'true' )))) ORDER BY `hosts`.`name` ASC LIMIT 150 OFFSET 0


Related issues

Related to Foreman - Feature #11150: Allow searching of facts as types other than stringClosed2015-07-19

History

#1 Updated by Timo Goebel about 4 years ago

  • Related to Feature #11150: Allow searching of facts as types other than string added

#2 Updated by Timo Goebel about 4 years ago

  • Assignee set to Timo Goebel

#3 Updated by Dominic Cleal about 4 years ago

Can you see any pattern to the hosts that are missing from the second query (missing facts, different fact values)? The queries are slightly different but I don't see why they'd produce different results.

#4 Updated by Timo Goebel about 4 years ago

  • Status changed from New to Rejected

While investigating this further, I could not reproduce it again. I take this back for the time being. Thanks, Dominic.

Also available in: Atom PDF