[Rt-commit] rt branch, 4.2/sphinx-config, created. rt-4.2.9-48-g35258c1

Alex Vandiver alexmv at bestpractical.com
Fri Dec 5 15:42:27 EST 2014


The branch, 4.2/sphinx-config has been created
        at  35258c14eb3f92f36084395a977b2d58c7e56767 (commit)

- Log -----------------------------------------------------------------
commit 35258c14eb3f92f36084395a977b2d58c7e56767
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Dec 1 16:50:37 2014 -0500

    Sphinx 1.10 and above want an explicit binlog_path
    
    Not explicitly setting binlog_path causes it to fall back to the
    compiled-in default (often the current directory), which may cause
    searchd to not start:
    
        http://sphinxsearch.com/docs/current.html#conf-binlog-path
    
    Add an explicit binlog_path, accompanied by a comment that is is only
    valid on 1.10 and above, as some distributions only ship 0.9.8.  This is
    not done automatically by detecting the sphinx version, as the sphinx
    binary may not be in PATH, or may be run from a remote server.
    
    Tests are updated to adjust output from rt-setup-fulltext-index which
    may be for the wrong version of sphinx.

diff --git a/sbin/rt-setup-fulltext-index.in b/sbin/rt-setup-fulltext-index.in
index 5ca4eae..28c988f 100644
--- a/sbin/rt-setup-fulltext-index.in
+++ b/sbin/rt-setup-fulltext-index.in
@@ -239,6 +239,8 @@ searchd {
     seamless_rotate         = 1
     preopen_indexes         = 0
     unlink_old              = 1
+    # For sphinx >= 1.10:
+    binlog_path             = $var_path/sphinx/
 }
 
 END
diff --git a/t/fts/indexed_mysql.t b/t/fts/indexed_mysql.t
index 0a4f026..6d028f8 100644
--- a/t/fts/indexed_mysql.t
+++ b/t/fts/indexed_mysql.t
@@ -13,6 +13,11 @@ $sphinx{'indexer'} = RT::Test->find_executable('indexer');
 plan skip_all => "No searchd and indexer under PATH"
     unless $sphinx{'searchd'} && $sphinx{'indexer'};
 
+plan skip_all => "Can't determine sphinx version"
+    unless `$sphinx{searchd} --version` =~ /Sphinx (\d+)\.(\d+)(?:\.(\d+))?/;
+
+$sphinx{version} = sprintf "%d.%03d%03d", $1, $2, ($3 || 0);
+
 plan tests => 15;
 
 RT->Config->Set( FullTextSearch => Enable => 1, Indexed => 1, Table => 'AttachmentsIndex', MaxMatches => 1000 );
@@ -44,6 +49,17 @@ sub setup_indexing {
     $sphinx_conf =~ s/.*?source rt \{/source rt {/ms;
     $sphinx_conf =~ s{\Q$RT::VarPath\E/sphinx/}{$tmp/}g;
 
+    # Remove lines for different versions of sphinx than we're running
+    $sphinx_conf =~ s{^(\s+ \# \s+ for \s+ sphinx \s+
+                          (<=?|>=?|=) \s*
+                          (\d+) \. (\d+) (?:\. (\d+))?
+                          .* \n)
+                      ((?:^\s* \w .*\n)+)}{
+        my $v = sprintf "%d.%03d%03d", $3, $4, ($5 || 0);
+        my $prefix = eval "$sphinx{version} $2 $v" ? "" : "#";
+        $1 . join("\n",map{"$prefix$_"} split "\n", $6) . "\n";
+    }emix;
+
     $sphinx{'config'} = File::Spec->catfile( $tmp, 'sphinx.conf' );
     {
         open my $fh, ">", $sphinx{'config'};

-----------------------------------------------------------------------


More information about the rt-commit mailing list