Skip to content

Commit 576a5f0

Browse files
committed
MDEV-20647 Fix and enable SphinxSE tests
1 parent 46b7852 commit 576a5f0

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

storage/sphinx/mysql-test/sphinx/disabled.def

Lines changed: 0 additions & 2 deletions
This file was deleted.

storage/sphinx/mysql-test/sphinx/suite.pm

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ return "'indexer' binary not found" unless $exe_sphinx_indexer;
2323
my $exe_sphinx_searchd = &locate_sphinx_binary('searchd');
2424
return "'searchd' binary not found" unless $exe_sphinx_searchd;
2525

26+
my $sphinx_config= "$::opt_vardir/my_sphinx.conf";
27+
2628
# Check for Sphinx engine
2729

2830
return "SphinxSE not found" unless $ENV{HA_SPHINX_SO} or $::mysqld_variables{'sphinx'} eq "ON";
@@ -95,11 +97,38 @@ sub searchd_start {
9597
&::mtr_verbose("Started $sphinx->{proc}");
9698
}
9799

100+
sub wait_exp_backoff {
101+
my $timeout= shift; # Seconds
102+
my $start_wait= shift; # Seconds
103+
my $scale_factor= shift;
104+
105+
$searchd_status= "$exe_sphinx_searchd --status" .
106+
" --config $sphinx_config > /dev/null 2>&1";
107+
108+
my $scale= $start_wait;
109+
my $total_sleep= 0;
110+
while (1) {
111+
my $status = system($searchd_status);
112+
if (not $status) {
113+
return 0;
114+
}
115+
if ($total_sleep >= $timeout) {
116+
last;
117+
}
118+
119+
&::mtr_milli_sleep($scale * 1000);
120+
$total_sleep+= $scale;
121+
$scale*= $scale_factor;
122+
}
123+
124+
&::mtr_warning("Getting a response from searchd timed out");
125+
return 1
126+
}
127+
98128
sub searchd_wait {
99129
my ($sphinx) = @_; # My::Config::Group
100130

101-
return not &::sleep_until_file_created($sphinx->value('pid_file'), 20,
102-
$sphinx->{'proc'})
131+
return wait_exp_backoff(30, 0.1, 2)
103132
}
104133

105134
############# declaration methods ######################

storage/sphinx/mysql-test/sphinx/union-5539.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ id w query
55
2 1 ;mode=extended2;limit=1000000;maxmatches=500
66
3 1 ;mode=extended2;limit=1000000;maxmatches=500
77
4 1 ;mode=extended2;limit=1000000;maxmatches=500
8+
5 1 ;mode=extended2;limit=1000000;maxmatches=500
89
SELECT a.* FROM (SELECT * FROM ts si WHERE si.query='@* 123nothingtofind123;mode=extended2;limit=1000000;maxmatches=500') AS a UNION SELECT b.* FROM (SELECT * FROM ts si WHERE si.query=';mode=extended2;limit=1000000;maxmatches=500') AS b;
910
id w query
1011
1 1 ;mode=extended2;limit=1000000;maxmatches=500
1112
2 1 ;mode=extended2;limit=1000000;maxmatches=500
1213
3 1 ;mode=extended2;limit=1000000;maxmatches=500
1314
4 1 ;mode=extended2;limit=1000000;maxmatches=500
15+
5 1 ;mode=extended2;limit=1000000;maxmatches=500
1416
drop table ts;

0 commit comments

Comments
 (0)