Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.11
-
None
-
ManticoreSearch: 13.11.1
Operating System: Rocky Linux
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
I've also reported this issue to the ManticoreSearch team, and they confirmed that the fix should be made on the MariaDB side.
Here's the related GitHub issue for reference: https://github.com/manticoresoftware/manticoresearch/issues/3799
Attachments
Issue Links
- relates to
-
MDEV-19205 Sphinx unable to connect using a host name
-
- Closed
-