summaryrefslogtreecommitdiff
path: root/storage/sphinx
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-23 10:25:34 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-23 10:25:34 +0300
commitc016ea660ede8b7ff75f8ca65f73e2958262263a (patch)
treec8bc8579c738792f0769ea70f49348dc1baf51b3 /storage/sphinx
parent1bbe8c5e0f6823acd4780d7563e8c02f8b4c5a01 (diff)
parent2931fd2917cc130e34e5f3d9d6c571a2b013e49c (diff)
downloadmariadb-git-c016ea660ede8b7ff75f8ca65f73e2958262263a.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'storage/sphinx')
-rw-r--r--storage/sphinx/ha_sphinx.cc7
-rw-r--r--storage/sphinx/mysql-test/sphinx/sphinx.result20
-rw-r--r--storage/sphinx/mysql-test/sphinx/sphinx.test13
3 files changed, 37 insertions, 3 deletions
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 13a46d495fe..812b362e737 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -2163,7 +2163,7 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort )
#if MYSQL_VERSION_ID>=50515
struct addrinfo *hp = NULL;
tmp_errno = getaddrinfo ( sHost, NULL, NULL, &hp );
- if ( !tmp_errno || !hp || !hp->ai_addr )
+ if ( tmp_errno || !hp || !hp->ai_addr )
{
bError = true;
if ( hp )
@@ -2190,8 +2190,9 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort )
}
#if MYSQL_VERSION_ID>=50515
- memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
- freeaddrinfo ( hp );
+ struct sockaddr_in *in = (sockaddr_in *)hp->ai_addr;
+ memcpy ( &sin.sin_addr, &in->sin_addr, Min ( sizeof(sin.sin_addr), sizeof(in->sin_addr) ) );
+ freeaddrinfo ( hp );
#else
memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
my_gethostbyname_r_free();
diff --git a/storage/sphinx/mysql-test/sphinx/sphinx.result b/storage/sphinx/mysql-test/sphinx/sphinx.result
index 3536ba42af8..c462d0cc883 100644
--- a/storage/sphinx/mysql-test/sphinx/sphinx.result
+++ b/storage/sphinx/mysql-test/sphinx/sphinx.result
@@ -75,3 +75,23 @@ id w q
1 2 test;range=meta.foo_count,100,500
5 1 test;range=meta.foo_count,100,500
drop table ts;
+#
+# MDEV-19205: Sphinx unable to connect using a host name
+#
+create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://localhost:SPHINXSEARCH_PORT/*";
+select * from ts where q=';filter=meta.foo_count,100';
+id w q
+1 1 ;filter=meta.foo_count,100
+select * from ts where q='test;filter=meta.sub.int,7';
+id w q
+5 1 test;filter=meta.sub.int,7
+select * from ts where q=';filter=meta.sub.list[0],4';
+id w q
+select * from ts where q=';filter=meta.sub.list[1],4';
+id w q
+5 1 ;filter=meta.sub.list[1],4
+select * from ts where q='test;range=meta.foo_count,100,500';
+id w q
+1 2 test;range=meta.foo_count,100,500
+5 1 test;range=meta.foo_count,100,500
+drop table ts;
diff --git a/storage/sphinx/mysql-test/sphinx/sphinx.test b/storage/sphinx/mysql-test/sphinx/sphinx.test
index fe388f7ddd2..b733a3fc5ff 100644
--- a/storage/sphinx/mysql-test/sphinx/sphinx.test
+++ b/storage/sphinx/mysql-test/sphinx/sphinx.test
@@ -41,3 +41,16 @@ select * from ts where q=';filter=meta.sub.list[0],4';
select * from ts where q=';filter=meta.sub.list[1],4';
select * from ts where q='test;range=meta.foo_count,100,500';
drop table ts;
+
+--echo #
+--echo # MDEV-19205: Sphinx unable to connect using a host name
+--echo #
+
+--replace_result $SPHINXSEARCH_PORT SPHINXSEARCH_PORT
+eval create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://localhost:$SPHINXSEARCH_PORT/*";
+select * from ts where q=';filter=meta.foo_count,100';
+select * from ts where q='test;filter=meta.sub.int,7';
+select * from ts where q=';filter=meta.sub.list[0],4';
+select * from ts where q=';filter=meta.sub.list[1],4';
+select * from ts where q='test;range=meta.foo_count,100,500';
+drop table ts;