-
-
Notifications
You must be signed in to change notification settings - Fork 617
Description
Bug Description:
The sphinx_snippets()
UDF fails to connect when provided a hostname in the connection string. The function only works with a direct IP address, even when the hostname is defined in /etc/hosts
. In contrast, direct queries using the SphinxSE successfully resolve the same hostname.
When calling the sphinx_snippets()
UDF from within MariaDB, using a hostname for the Manticore Search daemon (e.g., sphinx://manticoresearchhost:9312) results in a failed to resolve searchd host
error.
This forces the use of hardcoded IP addresses for snippet generation, which is inflexible and inconsistent with the behavior of the native SphinxSE engine.
Steps to Reproduce
Failing UDF Call (using Hostname): This query fails, despite manticoresearchhost
being resolvable.
SELECT sphinx_snippets(field_name, 'index_name', 'search_term', 'sphinx://manticoresearchhost:9312' AS sphinx) FROM table_name
Working UDF Call (using IP address): The UDF call executes successfully with a direct IP.
SELECT sphinx_snippets(field_name, 'index_name', 'search_term', 'sphinx://10.1.2.3:9312' AS sphinx) FROM table_name
Expected vs. Actual Behavior
The sphinx_snippets()
function should successfully resolve the hostname manticoresearchhost
and connect to the Manticore daemon, consistent with the SphinxSE storage engine's functionality, but the query fails with a name resolution error specific to the UDF:
SQLSTATE[HY000]: General error: 1429 Unable to connect to foreign data source: failed to resolve searchd host (name=manticoresearchhost)
Example of a working SphinxSE query:
Crucially, direct queries using the SphinxSE work correctly with the same hostname. This demonstrates that the connection logic within SphinxSE is capable of name resolution, and the issue is specific to the sphinx_snippets()
UDF's implementation.
This query successfully resolves manticoresearchhost
and returns results
SELECT * FROM `my_index` WHERE `query` = 'query=search_term; host=manticoresearchhost; port=9312;';
Hostname resolution is confirmed via an explicit entry in the /etc/hosts
file:
10.1.2.3 manticoresearchhost
System-level name resolution check:
# sudo -u mysql getent ahosts manticoresearchhost
10.1.2.3 STREAM manticoresearchhost
10.1.2.3 DGRAM
10.1.2.3 RAW
Manticore Search Version:
13.11.1
Operating System Version:
Rocky Linux
Have you tried the latest development version?
Yes
Internal Checklist:
To be completed by the assignee. Check off tasks that have been completed or are not applicable.
- Implementation completed
- Tests developed
- Documentation updated
- Documentation reviewed