Commit 576a5f09 authored by Robert Bindar's avatar Robert Bindar

MDEV-20647 Fix and enable SphinxSE tests

parent 46b78526
sphinx : MDEV-10986, MDEV-10985
union-5539 : MDEV-10986, MDEV-10985
...@@ -23,6 +23,8 @@ return "'indexer' binary not found" unless $exe_sphinx_indexer; ...@@ -23,6 +23,8 @@ return "'indexer' binary not found" unless $exe_sphinx_indexer;
my $exe_sphinx_searchd = &locate_sphinx_binary('searchd'); my $exe_sphinx_searchd = &locate_sphinx_binary('searchd');
return "'searchd' binary not found" unless $exe_sphinx_searchd; return "'searchd' binary not found" unless $exe_sphinx_searchd;
my $sphinx_config= "$::opt_vardir/my_sphinx.conf";
# Check for Sphinx engine # Check for Sphinx engine
return "SphinxSE not found" unless $ENV{HA_SPHINX_SO} or $::mysqld_variables{'sphinx'} eq "ON"; return "SphinxSE not found" unless $ENV{HA_SPHINX_SO} or $::mysqld_variables{'sphinx'} eq "ON";
...@@ -95,11 +97,38 @@ sub searchd_start { ...@@ -95,11 +97,38 @@ sub searchd_start {
&::mtr_verbose("Started $sphinx->{proc}"); &::mtr_verbose("Started $sphinx->{proc}");
} }
sub wait_exp_backoff {
my $timeout= shift; # Seconds
my $start_wait= shift; # Seconds
my $scale_factor= shift;
$searchd_status= "$exe_sphinx_searchd --status" .
" --config $sphinx_config > /dev/null 2>&1";
my $scale= $start_wait;
my $total_sleep= 0;
while (1) {
my $status = system($searchd_status);
if (not $status) {
return 0;
}
if ($total_sleep >= $timeout) {
last;
}
&::mtr_milli_sleep($scale * 1000);
$total_sleep+= $scale;
$scale*= $scale_factor;
}
&::mtr_warning("Getting a response from searchd timed out");
return 1
}
sub searchd_wait { sub searchd_wait {
my ($sphinx) = @_; # My::Config::Group my ($sphinx) = @_; # My::Config::Group
return not &::sleep_until_file_created($sphinx->value('pid_file'), 20, return wait_exp_backoff(30, 0.1, 2)
$sphinx->{'proc'})
} }
############# declaration methods ###################### ############# declaration methods ######################
......
...@@ -5,10 +5,12 @@ id w query ...@@ -5,10 +5,12 @@ id w query
2 1 ;mode=extended2;limit=1000000;maxmatches=500 2 1 ;mode=extended2;limit=1000000;maxmatches=500
3 1 ;mode=extended2;limit=1000000;maxmatches=500 3 1 ;mode=extended2;limit=1000000;maxmatches=500
4 1 ;mode=extended2;limit=1000000;maxmatches=500 4 1 ;mode=extended2;limit=1000000;maxmatches=500
5 1 ;mode=extended2;limit=1000000;maxmatches=500
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; 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;
id w query id w query
1 1 ;mode=extended2;limit=1000000;maxmatches=500 1 1 ;mode=extended2;limit=1000000;maxmatches=500
2 1 ;mode=extended2;limit=1000000;maxmatches=500 2 1 ;mode=extended2;limit=1000000;maxmatches=500
3 1 ;mode=extended2;limit=1000000;maxmatches=500 3 1 ;mode=extended2;limit=1000000;maxmatches=500
4 1 ;mode=extended2;limit=1000000;maxmatches=500 4 1 ;mode=extended2;limit=1000000;maxmatches=500
5 1 ;mode=extended2;limit=1000000;maxmatches=500
drop table ts; drop table ts;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment