SOLR slave正在执行完整复制,因为它无法删除未使用的索引目录

时间:2017-11-14 07:12:50

标签: solr lucene solrj

当从属设备复制索引时,它会创建一个名称格式为的索引目录 index.timestamp下次复制它时会尝试清理并创建一个带有新时间戳的新文件夹但在我的情况下它没有发生,每当我看到这个警告时,Slave会触发一个fullCopy

Unable to cleanup unused lucene index files so we must do a full copy instead

任何人为什么奴隶都无法清理未使用的索引文件。

谢谢

1 个答案:

答案 0 :(得分:3)

如果不知道你的solr版本,就很难回答。

根据我的经验,solr会复制不同的索引文件(比时间戳更新)。但是,如果合并索引,则会触发完整副本。

以下是一些相关的门票

https://issues.apache.org/jira/browse/SOLR-6640

**更新11/27/2017 **

这是5x分支中的相关部分,

https://github.com/apache/lucene-solr/blob/branch_5x/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java#L398-L418

try {
    IndexWriter indexWriter = writer.get();
    int c = 0;
    indexWriter.deleteUnusedFiles();
    while (hasUnusedFiles(indexDir, commit)) {
        indexWriter.deleteUnusedFiles();
        LOG.info("Sleeping for 1000ms to wait for unused lucene index files to be delete-able");
        Thread.sleep(1000);
        c++;
        if (c >= 30) {
            LOG.warn("IndexFetcher unable to cleanup unused lucene index files so we must do a full copy instead");
            isFullCopyNeeded = true;
            break;
        }
    }
    if (c > 0)  {
        LOG.info("IndexFetcher slept for " + (c * 1000) + "ms for unused lucene index files to be delete-able");
    }
} finally {
    writer.decref();
}

因此,您有超过30个未使用的索引文件,这将触发警告消息&完整副本。 我会尝试优化或合并主服务器中的索引,并查看是否复制了fullCopy。