Bug #13838
closedSearching for hosts by facts does not return all hosts
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