A problem with sphinx incremental indexes

  • 2020-05-07 19:25:02
  • OfStack

But recently found that the incremental search is always not available, today I looked at the running log, there are the following tips:

[Sun Apr 17 19:30:01.876 2011] [ 3400] WARNING: rotating index 'news_delta': cur to old rename failed: rename /dev/shm/sphinx/data/news_delta.spa to /dev/shm/sphinx/data/news_delta.old.spa failed: No such file or directory

[Sun Apr 17 19:30:01.881 2011] [ 3400] WARNING: rotating index 'article_delta': cur to old rename failed: rename /dev/shm/sphinx/data/article_delta.spa to /dev/shm/sphinx/data/article_delta.old.spa failed: No such file or directory

For improving the incremental indexing speed, I will be incremental index in/dev shm, watch the next/dev/shm/sphinx/data/directory content:
-rw-r--r-- 1 root root 385762 Apr 17 19:21 article_delta.new.spd
-rw-r--r-- 1 root root 3713 Apr 17 19:21 article_delta.new.sph
-rw-r--r-- 1 root root 46260 Apr 17 19:21 article_delta.new.spi
-rw-r--r-- 1 root root 0 Apr 17 19:21 article_delta.new.spk
-rw-r--r-- 1 root root 0 Apr 17 19:21 article_delta.new.spm
-rw-r--r-- 1 root root 261402 Apr 17 19:21 article_delta.new.spp

Strangely, it should be article_delta.spd, not.new.
The incremental index USES the --rotate parameter,
 
bin/indexer --rotate news_delta 
bin/indexer --rotate article_delta 

At rotate, you need to rename article_delta.spa to article_delta.old.spa, then rename article_delta.new.spa to article_delta.spa, and then notify searchd to restart rotate.

I remembered that I restarted the machine in the early morning a few days ago, and all the original files were lost, so I could not rotate:()

Solutions:
Run: bin/indexer article_delta
article_delta.spd,sph, etc.

Run again: bin/indexer article_delta --rotate
Run log prompt: rotating index 'article_delta': success
Normal!

Script the command to do the incremental index in rc.local so that the problem will not occur after the machine is restarted.
 
echo "start:" $(date +"%y-%m-%d %H:%M:%S") 
cd /usr/local/coreseek/bin 
./indexer news_delta 
./indexer article_delta 
echo "end:" $(date +"%y-%m-%d %H:%M:%S") 

Related articles: