[Commits] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2 branch (knielsen:2800)

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Thu Jul 1 14:16:52 EEST 2010


#At lp:maria/5.2

 2800 knielsen at knielsen-hq.org	2010-07-01
      Fixes and cleanup for Sphinx storage engine:
      
       - Cleanup/simplify test suite extensions.
       - BIGINT in test cases to work with id64 builds.
       - Don't try to run with Sphinx 0.9.8, as it won't work.
       - Run Sphinx test suite by default (if Sphinx is available).
       - SphinxSE plugin is of stable maturity according to Andrew.
       - Since we now use XML to load data, we don't need to load SQL data file.
      removed:
        mysql-test/std_data/sphinx_example.sql
      modified:
        mysql-test/include/have_sphinx.inc
        mysql-test/mysql-test-run.pl
        mysql-test/suite/sphinx/sphinx.result
        mysql-test/suite/sphinx/sphinx.test
        storage/sphinx/ha_sphinx.cc

=== modified file 'mysql-test/include/have_sphinx.inc'
--- a/mysql-test/include/have_sphinx.inc	2010-05-27 22:30:06 +0000
+++ b/mysql-test/include/have_sphinx.inc	2010-07-01 11:16:48 +0000
@@ -1,4 +1,4 @@
 disable_query_log;
 --require r/true.require
-eval SELECT LENGTH('$HAVE_SPHINX_DNS') = 0 AS 'TRUE';
+eval SELECT LENGTH('$HAVE_SPHINX') >= 0 AS 'TRUE';
 enable_query_log;

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2010-05-27 22:30:06 +0000
+++ b/mysql-test/mysql-test-run.pl	2010-07-01 11:16:48 +0000
@@ -127,7 +127,7 @@ my $path_config_file_sphinx;    # Same f
 # executables will be used by the test suite.
 our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
 
-my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,vcol,oqgraph";
+my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,vcol,oqgraph,sphinx";
 my $opt_suites;
 
 our $opt_verbose= 0;  # Verbose output, enable with --verbose
@@ -1730,47 +1730,43 @@ sub executable_setup () {
   }
 
   # Look for Sphinx binaries.
-  if ($ENV{SPHINXSEARCH_INDEXER})
-  {
-    $exe_sphinx_indexer= $ENV{SPHINXSEARCH_INDEXER}
-      if -x $ENV{SPHINXSEARCH_INDEXER};
-  }
-  else
+  locate_sphinx_binary('indexer', \$exe_sphinx_indexer);
+  locate_sphinx_binary('searchd', \$exe_sphinx_searchd);
+
+  if ($exe_sphinx_indexer && $exe_sphinx_searchd)
   {
-    for (qw (/usr/bin/indexer /usr/local/indexer /usr/local/sphinx/bin/indexer))
+    # We need at least Sphinx version 0.9.9.
+    my $out= qx"\"$exe_sphinx_searchd\" --help";
+    if ($out =~ /([0-9]+)\.([0-9]+)\.([0-9]+)/ &&
+        ($1 > 0 || $2 > 9 || ($2 == 9 && $3 >= 9)))
     {
-      if (-x $_)
-      {
-        $exe_sphinx_indexer= $_;
-        last;
-      }
+      $ENV{HAVE_SPHINX}= 1;
     }
-  }
-
-  if ($ENV{SPHINXSEARCH_SEARCHD})
-  {
-    $exe_sphinx_searchd= $ENV{SPHINXSEARCH_SEARCHD}
-      if -x $ENV{SPHINXSEARCH_SEARCHD};
-  }
-  else
-  {
-    for (qw (/usr/bin/searchd /usr/local/searchd /usr/local/sphinx/bin/searchd))
+    else
     {
-      if (-x $_)
-      {
-        $exe_sphinx_searchd= $_;
-        last;
-      }
+      print "Found Sphinx `$exe_sphinx_searchd', but it is too old\n",
+        "(at least version 0.9.9 is needed).\n",
+        "Skipping SphinxSE tests.\n";
     }
   }
+}
 
-  if ($exe_sphinx_indexer && $exe_sphinx_searchd)
+sub locate_sphinx_binary {
+  my ($name, $ref)= @_;
+  $$ref= undef;
+  my @list= map("$_/bin/$name", qw(/usr /usr/local /usr/local/sphinx));
+  my $env_override= $ENV{'SPHINXSEARCH_'. uc($name)};
+  @list= ($env_override) if $env_override;
+  for my $c (@list)
   {
-    $ENV{HAVE_SPHINX}= 1;
+    if (-x $c)
+    {
+      $$ref= $c;
+      last;
+    }
   }
 }
 
-
 sub client_debug_arg($$) {
   my ($args, $client_name)= @_;
 
@@ -5175,21 +5171,14 @@ sub start_servers($) {
   }
 
   # Now start sphinx server, if needed.
-  # This has to be done after mysqld is started, as it's needed by indexer.
   foreach my $sphinx (sphinxes())
   {
     # First we must run the indexer to create the data.
     my $sphinx_log= "$opt_vardir/sphinx.log";
     my $sphinx_data_dir= "$opt_vardir/sphinxdata";
     mkpath($sphinx_data_dir) unless -d $sphinx_data_dir;
-    # ToDo: SafeProcess? check what bootstrap does.
     my $sphinx_config= "$opt_vardir/my_sphinx.conf";
-    my $cmd;
-    $cmd= "$ENV{MYSQL} < $glob_mysql_test_dir/std_data/sphinx_example.sql > $sphinx_log 2>&1";
-    #print STDERR "XXX: $cmd\n";
-    system($cmd);
-    $cmd= "$exe_sphinx_indexer --config $sphinx_config test1 >> $sphinx_log 2>&1";
-    #print STDERR "XXX: $cmd\n";
+    my $cmd= "\"$exe_sphinx_indexer\" --config \"$sphinx_config\" test1 > \"$sphinx_log\" 2>&1";
     system($cmd);
 
     # Then start the searchd daemon.

=== removed file 'mysql-test/std_data/sphinx_example.sql'
--- a/mysql-test/std_data/sphinx_example.sql	2010-05-27 22:30:06 +0000
+++ b/mysql-test/std_data/sphinx_example.sql	1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-DROP TABLE IF EXISTS test.documents;
-
-CREATE TABLE test.documents
-(
-	id			INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
-	group_id	INTEGER NOT NULL,
-	group_id2	INTEGER NOT NULL,
-	date_added	DATETIME NOT NULL,
-	title		VARCHAR(255) NOT NULL,
-	content		TEXT NOT NULL
-);
-
-REPLACE INTO test.documents ( id, group_id, group_id2, date_added, title, content ) VALUES
-	( 1, 1, 5, NOW(), 'test one', 'this is my test document number one. also checking search within phrases.' ),
-	( 2, 1, 6, NOW(), 'test two', 'this is my test document number two' ),
-	( 3, 2, 7, NOW(), 'another doc', 'this is another group' ),
-	( 4, 2, 8, NOW(), 'doc number four', 'this is to test groups' );
-
-DROP TABLE IF EXISTS test.tags;
-
-CREATE TABLE test.tags
-(
-	docid INTEGER NOT NULL,
-	tagid INTEGER NOT NULL,
-	UNIQUE(docid,tagid)
-);
-
-INSERT INTO test.tags VALUES
-	(1,1), (1,3), (1,5), (1,7),
-	(2,6), (2,4), (2,2),
-	(3,15),
-	(4,7), (4,40);

=== modified file 'mysql-test/suite/sphinx/sphinx.result'
--- a/mysql-test/suite/sphinx/sphinx.result	2010-06-02 13:20:00 +0000
+++ b/mysql-test/suite/sphinx/sphinx.result	2010-07-01 11:16:48 +0000
@@ -1,11 +1,11 @@
-create table ts ( id int unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:SPHINXSEARCH_PORT/*";
+create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:SPHINXSEARCH_PORT/*";
 select * from ts where q='test';
 id	w	q
 1	2	test
 2	2	test
 4	1	test
 drop table ts;
-create table ts ( id int unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:13002/*";
+create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:13002/*";
 select * from ts where q='test;filter=gid,1;mode=extended';
 id	w	q
 1	2421	test;filter=gid,1;mode=extended
@@ -23,7 +23,7 @@ select id, w from ts where q='one';
 id	w
 1	2
 drop table ts;
-create table ts ( id int unsigned not null, w int not null, q varchar(255) not null, gid int not null, _sph_count int not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:13002/test1";
+create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, gid int not null, _sph_count int not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:13002/test1";
 select * from ts;
 id	w	q	gid	_sph_count
 select * from ts where q='';

=== modified file 'mysql-test/suite/sphinx/sphinx.test'
--- a/mysql-test/suite/sphinx/sphinx.test	2010-06-02 13:20:00 +0000
+++ b/mysql-test/suite/sphinx/sphinx.test	2010-07-01 11:16:48 +0000
@@ -2,11 +2,11 @@
 --source include/have_sphinxse.inc
 
 --replace_result $SPHINXSEARCH_PORT SPHINXSEARCH_PORT
-eval create table ts ( id int unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:$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://127.0.0.1:$SPHINXSEARCH_PORT/*";
 select * from ts where q='test';
 drop table ts;
 
-eval create table ts ( id int unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:$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://127.0.0.1:$SPHINXSEARCH_PORT/*";
 select * from ts where q='test;filter=gid,1;mode=extended';
 select * from ts where q='test|one;mode=extended';
 select * from ts where q='test;offset=1;limit=1';
@@ -14,7 +14,7 @@ eval alter table ts connection="sphinx:/
 select id, w from ts where q='one';
 drop table ts;
 
-eval create table ts ( id int unsigned not null, w int not null, q varchar(255) not null, gid int not null, _sph_count int not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:$SPHINXSEARCH_PORT/test1";
+eval create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, gid int not null, _sph_count int not null, index(q) ) engine=sphinx connection="sphinx://127.0.0.1:$SPHINXSEARCH_PORT/test1";
 select * from ts;
 select * from ts where q='';
 select * from ts where q=';groupby=attr:gid';

=== modified file 'storage/sphinx/ha_sphinx.cc'
--- a/storage/sphinx/ha_sphinx.cc	2010-05-27 22:30:06 +0000
+++ b/storage/sphinx/ha_sphinx.cc	2010-07-01 11:16:48 +0000
@@ -3179,7 +3179,7 @@ maria_declare_plugin(sphinx)
 	sphinx_status_vars,
 	NULL,
 	"0.1", // string version
-	MariaDB_PLUGIN_MATURITY_GAMMA
+	MariaDB_PLUGIN_MATURITY_STABLE
 }
 maria_declare_plugin_end;
 



More information about the commits mailing list