summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bindar <robert@mariadb.org>2019-09-24 16:20:59 +0300
committerRobert Bindar <robert@mariadb.org>2019-09-30 15:47:09 +0300
commit576a5f091ebc052c0379e5032b9898787e519776 (patch)
tree6423eb5dd13be364624812b6ff868692bfabaa54
parent46b785262b9f03c4d715fa8ebbeb0d9bc6bb71c0 (diff)
downloadmariadb-git-576a5f091ebc052c0379e5032b9898787e519776.tar.gz
MDEV-20647 Fix and enable SphinxSE tests
-rw-r--r--storage/sphinx/mysql-test/sphinx/disabled.def2
-rw-r--r--storage/sphinx/mysql-test/sphinx/suite.pm33
-rw-r--r--storage/sphinx/mysql-test/sphinx/union-5539.result2
3 files changed, 33 insertions, 4 deletions
diff --git a/storage/sphinx/mysql-test/sphinx/disabled.def b/storage/sphinx/mysql-test/sphinx/disabled.def
deleted file mode 100644
index a85b8b71e52..00000000000
--- a/storage/sphinx/mysql-test/sphinx/disabled.def
+++ /dev/null
@@ -1,2 +0,0 @@
-sphinx : MDEV-10986, MDEV-10985
-union-5539 : MDEV-10986, MDEV-10985
diff --git a/storage/sphinx/mysql-test/sphinx/suite.pm b/storage/sphinx/mysql-test/sphinx/suite.pm
index 24c377d7665..e44a8e626df 100644
--- a/storage/sphinx/mysql-test/sphinx/suite.pm
+++ b/storage/sphinx/mysql-test/sphinx/suite.pm
@@ -23,6 +23,8 @@ return "'indexer' binary not found" unless $exe_sphinx_indexer;
my $exe_sphinx_searchd = &locate_sphinx_binary('searchd');
return "'searchd' binary not found" unless $exe_sphinx_searchd;
+my $sphinx_config= "$::opt_vardir/my_sphinx.conf";
+
# Check for Sphinx engine
return "SphinxSE not found" unless $ENV{HA_SPHINX_SO} or $::mysqld_variables{'sphinx'} eq "ON";
@@ -95,11 +97,38 @@ sub searchd_start {
&::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 {
my ($sphinx) = @_; # My::Config::Group
- return not &::sleep_until_file_created($sphinx->value('pid_file'), 20,
- $sphinx->{'proc'})
+ return wait_exp_backoff(30, 0.1, 2)
}
############# declaration methods ######################
diff --git a/storage/sphinx/mysql-test/sphinx/union-5539.result b/storage/sphinx/mysql-test/sphinx/union-5539.result
index ab694b7db6a..945e0141b7b 100644
--- a/storage/sphinx/mysql-test/sphinx/union-5539.result
+++ b/storage/sphinx/mysql-test/sphinx/union-5539.result
@@ -5,10 +5,12 @@ id w query
2 1 ;mode=extended2;limit=1000000;maxmatches=500
3 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;
id w query
1 1 ;mode=extended2;limit=1000000;maxmatches=500
2 1 ;mode=extended2;limit=1000000;maxmatches=500
3 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;