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

SOLR slave is doing full Copy as it was not able to Delete unused Index dir

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

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

任何人都可以知道为什么 slave 无法清理未使用的索引文件。

感谢

不知道你的solr版本很难回答。

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

这是一些相关的工单

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

** 2017 年 11 月 27 日更新 **

这是 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 个未使用的索引文件,这将触发警告消息和完整副本。 我会尝试优化或合并来自 master 的索引,看看是否复制了 fullCopy。