Gadelkareem
Gadelkareem

Reputation: 1097

Sphinx Error: failed to merge index

While merging index with delta on Sphinx, I got this error:

~: /usr/local/bin/indexer --merge myindex myindexDelta --rotate;
Sphinx 2.0.6-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc ( http://sphinxsearch.com )

using config file '/usr/local/etc/sphinx.conf'...
merging index 'myindexDelta' into index 'myindex'...
read 414.6 of 414.6 MB, 100.0% done
FATAL: failed to merge index 'myindexDelta' into index 'myindex': failed to open /server/sphinx/data/myindex.sps: No such file or directory

My configuration on sphinx.conf is as following

source myindex
{
     type = mysql
     sql_host = localhost
     sql_user = db
     sql_pass =
     sql_db     = db
     sql_query_pre = SET SESSION query_cache_type=OFF
     sql_query_pre  = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM mytable
     sql_query_pre  = SET NAMES utf8

     sql_query = \
                 SELECT  id,title FROM mytable \
                 WHERE id<=( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 )
     sql_ranged_throttle = 0
}

source myindexDelta : myindex
{
     sql_query_pre = SET SESSION query_cache_type=OFF
     sql_query_pre = SET NAMES utf8
     sql_query = \
             SELECT  id,title FROM mytable \
             WHERE id > ( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 )
}

index myindex
{
     source = myindex
     path = /server/sphinx/data/myindex
     min_word_len = 3
     min_infix_len = 0
}

index myindexDelta : myindex
{
     source = myindexDelta
     path = /server/sphinx/data/myindexDelta
     min_word_len = 3
     min_infix_len = 0
}

indexes files listings with permissions:

~: ls -lh /server/sphinx/data/
-rw-r--r-- 1 root root    0 Nov 11 21:40 myindexDelta.spa
-rw-r--r-- 1 root root 290K Nov 11 21:40 myindexDelta.spd
-rw-r--r-- 1 root root  328 Nov 11 21:40 myindexDelta.sph
-rw-r--r-- 1 root root 106K Nov 11 21:40 myindexDelta.spi
-rw-r--r-- 1 root root    0 Nov 11 21:40 myindexDelta.spk
-rw------- 1 root root    0 Nov 11 21:40 myindexDelta.spl
-rw-r--r-- 1 root root    0 Nov 11 21:40 myindexDelta.spm
-rw-r--r-- 1 root root 223K Nov 11 21:40 myindexDelta.spp
-rw-r--r-- 1 root root    1 Nov 11 21:40 myindexDelta.sps
-rw-r--r-- 1 root root    0 Jul  3 21:17 myindex.spa
-rw-r--r-- 1 root root 7.0G Jul  3 23:54 myindex.spd
-rw-r--r-- 1 root root  290 Jul  3 23:54 myindex.sph
-rw-r--r-- 1 root root 397M Jul  3 23:54 myindex.spi
-rw-r--r-- 1 root root    0 Jul  3 23:54 myindex.spk
-rw------- 1 root root    0 Nov 11 21:08 myindex.spl
-rw-r--r-- 1 root root    0 Jul  3 21:17 myindex.spm
-rw-r--r-- 1 root root 9.2G Jul  3 23:54 myindex.spp

I am sure the code explains everything, adding description is not necessary.

Upvotes: 0

Views: 998

Answers (1)

barryhunter
barryhunter

Reputation: 21091

I'm guessing that the original 'myindex' was made by a different version of sphinx. (ie dont think 2.0.6-release would of been available in July)

And somewhere in that version update, the requirement for a .sps file has changed - the new version requires it, whereas the old doesnt. You have no string attributes hence why the file contains no data in the delta.

I would suggest either rebuilding myindex with your current version of indexer - so they versions are identical.

Or maybe you could try copying myindexDelta.sps to myindex.sps. It contains no data (1 dummy byte!) so it shouldn't corrupt anything. Would only need to do this once.

Upvotes: 2

Related Questions