[Rt-commit] rt branch, 4.2/sphinx-config, created. rt-4.2.10-97-g759ca26

Alex Vandiver alexmv at bestpractical.com
Wed Mar 4 17:12:53 EST 2015


The branch, 4.2/sphinx-config has been created
        at  759ca268f2492faeda3dd77fb0ddadb506dfd304 (commit)

- Log -----------------------------------------------------------------
commit 759ca268f2492faeda3dd77fb0ddadb506dfd304
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 b5659c7..a71b2f5 100644
--- a/sbin/rt-setup-fulltext-index.in
+++ b/sbin/rt-setup-fulltext-index.in
@@ -287,6 +287,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_sphinx.t b/t/fts/indexed_sphinx.t
index a09b0d2..38e5618 100644
--- a/t/fts/indexed_sphinx.t
+++ b/t/fts/indexed_sphinx.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;
 
 setup_indexing();
@@ -43,6 +48,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