Sphinx错误:无法合并索引

时间:2012-11-11 19:57:40

标签: mysql linux merge sphinx

在Sphinx上将索引与delta合并时,我收到了这个错误:

~: /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

我在sphinx.conf上的配置如下

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
}

使用权限索引文件列表:

~: 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

我确信代码解释了所有内容,不需要添加说明。

1 个答案:

答案 0 :(得分:2)

我猜测原来的'myindex'是由不同版本的sphinx制作的。 (即不要认为7.0.6版本将于7月发布)

在该版本更新的某个地方,对.sps文件的要求已经改变 - 新版本需要它,而旧版本则不需要。您没有字符串属性,因此该文件在delta中不包含任何数据。

我建议使用当前版本的索引器重建myindex - 因此它们的版本完全相同。

或许您可以尝试将 myindexDelta.sps 复制到 myindex.sps 。它不包含任何数据(1个虚拟字节!),因此它不应该破坏任何东西。只需要这样做一次。