狮身人面像:权限被拒绝/三角洲合并破损管道

时间:2015-09-25 16:11:05

标签: windows sphinx

当我为创建和合并增量启动此批处理命令时:

D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf idx_product_delta --rotate
D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf --merge idx_product_main idx_product_delta --rotate

在searchd.log中发现此错误和增量未合并到主

[Fri Sep 25 15:34:42.549 2015] [ 2312] WARNING: rotating index 'idx_product_main': cur to old rename failed: rename D:\Sphinx\project\data\product.spa to D:\Sphinx\project\data\product.old.spa failed: Broken pipe

控制台输出为:

using config file 'D:\Sphinx\project\product.conf'...
merging index 'idx_product_delta' into index 'idx_product_main'...
read 7.2 of 7.2 MB, 100.0% done
merged 11.5 Kwords
merged in 0.127 sec
ERROR: index 'idx_product_main': failed to delete 'D:\Sphinx\project\data\product.new.spa': Permission deniedtotal 671 reads, 0.006 sec, 15.3 kb/call avg, 0.0 msec/call avg total 36 writes, 0.004 sec, 277.8 kb/call avg, 0.1 msec/call avg

我的product.conf是:

source src_product_main
{
    type = mysql

    sql_host = localhost
    sql_user = root
    sql_pass =
    sql_db = database
    sql_port = 3306 # optional, default is 3306

    sql_query_pre = REPLACE INTO sphinx_index_meta(index_name, last_update) \
                    VALUES('idx_prodotti_main', current_timestamp())


    sql_query_range = SELECT MIN(id),MAX(id) \
                      FROM product \
                      WHERE deleted = 0 AND visible= 1

    sql_range_step = 1000

    sql_query = SELECT id, text, last_update \
                FROM product \
                WHERE id>=$start AND id<=$end AND deleted = 0 AND visible = 1

    sql_attr_timestamp = last_update
}


index idx_product_main
{
    source = src_product_main
    path = D:\Sphinx\project\data\product
    ondisk_attrs = 1
    stopwords = D:\Sphinx\project\stopwords.txt

    min_word_len = 2
    min_prefix_len = 0
    min_infix_len = 3
    ngram_len = 1
}


source src_product_delta : src_product_main
{
    sql_query_range = SELECT MIN(id),MAX(id) \
                      FROM product \
                      WHERE deleted = 0 AND visible= 1

    sql_range_step = 1000

    sql_query = SELECT id, text, last_update \
                FROM product \
                WHERE id>=$start AND id<=$end AND deleted = 0 AND visible = 1
}


index idx_product_delta : idx_product_main
{
    source = src_product_delta
    path = D:\Sphinx\project\delta\product
    ondisk_attrs = 1
    stopwords = D:\Sphinx\project\stopwords.txt

    min_word_len = 2
    min_prefix_len = 0
    min_infix_len = 3
    ngram_len = 1
}


indexer
{
    mem_limit = 128M
    max_iosize = 1M
}


searchd
{
    listen = 9312
    listen = 9306:mysql41
    log = D:\Sphinx\project\log\searchd.log
    query_log = D:\Sphinx\project\log\query.log
    read_timeout = 5
    client_timeout = 300
    max_children = 30
    pid_file = D:\Sphinx\project\log\searchd.pid
    seamless_rotate = 1
    preopen_indexes = 0
    unlink_old = 1
    workers = threads # for RT to work
    binlog_path = D:\Sphinx\project\data
}

我也尝试过Windows 7和Windows 8,包括稳定的2.2.10和beta 2.3.1-id64-beta(r4926)具有相同的错误。

  • 使用cron(Windows调度程序)作为SYSTEM用户
  • 运行的索引器
  • 以SYSTEM用户身份运行的searchd服务
  • D:\ Sphinx \ project \ data \ folder权限具有SYSTEM
  • 的完全控制权限

如何解决此问题

Eugene Soldatov answer

更新

我也试过(第一个命令少 - 旋转)

D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf idx_product_delta
D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf --merge idx_product_main idx_product_delta --rotate

但在控制台输出中发现此错误

Sphinx 2.2.10-id64-release (2c212e0)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file 'D:\Sphinx\project\product.conf'...
indexing index 'idx_prodotti_delta'...
FATAL: failed to lock D:\Sphinx\project\delta\prodotti.spl: No error, will not index. Try --rotate option.
Sphinx 2.2.10-id64-release (2c212e0)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file 'D:\Sphinx\project\product.conf'...
merging index 'idx_prodotti_delta' into index 'idx_prodotti_main'...
read 7.2 of 7.2 MB, 100.0% done
merged 11.5 Kwords
merged in 0.214 sec
ERROR: index 'idx_prodotti_main': failed to delete 'D:\Sphinx\project\data\prodotti.new.spa': Permission deniedtotal 20136 reads, 0.071 sec, 30.9 kb/call avg, 0.0 msec/call avg
total 36 writes, 0.012 sec, 283.3 kb/call avg, 0.3 msec/call avg

在searchd.log中发现此错误

[Wed Sep 30 09:09:29.371 2015] [ 4244] rotating index 'idx_prodotti_main': started
[Wed Sep 30 09:09:29.381 2015] [ 4244] WARNING: rotating index 'idx_prodotti_main': cur to old rename failed: rename D:\Sphinx\project\data\prodotti.spa to D:\Sphinx\project\data\prodotti.old.spa failed: Broken pipe
[Wed Sep 30 09:09:29.381 2015] [ 4244] rotating index: all indexes done

更新2

还尝试在两个命令之间插入sleep

D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf idx_product_delta --rotate
timeout /t 60
D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf --merge idx_product_main idx_product_delta --rotate

控制台输出:

ERROR: index 'idx_prodotti_main': failed to delete 'D:\Sphinx\project\data\prodotti.new.spa': Permission deniedtotal 20137 reads, 0.072 sec, 30.9 kb/c

更新3:问题已解决

sphinx家伙在这里解决了问题

http://sphinxsearch.com/bugs/view.php?id=2335

1 个答案:

答案 0 :(得分:2)

这种行为的原因是--rotate命令是异步的,所以当你运行第二个命令时:

D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf --merge idx_product_main idx_product_delta --rotate

首先可以继续使用索引idx_product_delta:

D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf idx_product_delta --rotate

,所以它被锁定了。

如果可能,请在第一个命令中删除--rotate选项。

更新:

在第一个命令中似乎需要--rotate选项。因此,您可以测量完成任务所需的平均时间,并在两个命令之间插入休眠。例如,持续30秒:

D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf idx_product_delta --rotate
timeout /t 30
D:\Sphinx\bin\indexer.exe --config D:\Sphinx\project\product.conf --merge idx_product_main idx_product_delta --rotate